Laravel Command Line Cheat Sheet

Below is a list of my most used com­mands in Lar­avel. This is not an exhaus­tive list of Lar­avel commands. 

I just want­ed to write them down to cement them into my brain & share with our team. Hope­ful­ly, this list of snip­pets proves use­ful to you as well.

These snip­pets apply to Lar­avel 5.3.x

Mod­els & Con­trollers #

php artisan make:model Location
php artisan make:controller ProfileDetailsController
php artisan make:controller SubmissionController --resource

Migra­tions #

Migra­tion files are under /database/migrations

php artisan make:migration create_locations_table --create=locations
php artisan make:migration add_price_to_form
php artisan migrate:refresh --seed
php artisan migrate --path=/database/migrations/custom
php artisan migrate --path=/database/migrations/2017_01_24_174050_add_company_to_user.php

Cre­at­ing Sam­ple Fake Data #

Fac­to­ry files are under /database/factories

Cre­at­ing fake data using a fac­to­ry #

New Way
factory('App\Form')->create();

Old Way
factory(App\Form::Class)->create();

Claudia Aguilar, Partner, Software Engineer

Claudia Aguilar

Partner, Software Engineer