Laravel – Artisan – Cheat Sheet31 Oct 2018Development Here’s an overview of what you could use while developing a project with Laravel.In order to create controllers, models, migrations, … we can use artisan. Creating a Controller php artisan make:controller MyController When we want artisan to provide a controller with the “resource functions” (index, create, store, show, edit, update, destroy) predefined for us, we can simply add “–resource” to our command to provide these functions out of the box. php artisan make:controller MyController --resource Creating a Model php artisan make:model If you want artisan to provide a migration file related to our newly created model, you can just add “-m” to the command. Which gives us something like this: php artisan make:model -m Creating a Migration file We’re also able to create our own migration file, for example is we want to add field to an existing table or create a pivot table, or … php artisan make:migration the_name_of_your_migration Just like the migration file that artisan provided for us when we used -m on the creation of a model, the migration file will be added to the /database/migrations folder. Deploy the migration file(s) to the database In order to get our migration file(s) migrated into the database, we need to tell artisan to migrate them. Like so: php artisan migrate Be aware that once a migration file has been migrated to the database, all changes to the file afterwards will be discarded. We’ll need to create a new migration file in order to add additional changes / migrations. In the database you can see the hierarchy of the migrations in the table migrations.