Laravel Command Line Cheat Sheet

Below is a list of my most used commands in Laravel. This is not an exhaustive list of Laravel commands.

I just wanted to write them down to cement them into my brain & share with our team. Hopefully, this list of snippets proves useful to you as well.

These snippets apply to Laravel 5.3.x

Models & Controllers #

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

Migrations #

Migration 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

Creating Sample Fake Data #

Factory files are under /database/factories

Creating fake data using a factory #

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

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

Claudia Aguilar, Partner, Software Engineer

Claudia Aguilar

Partner, Software Engineer