Laravel Cheatsheet - Laravel Artisan Command Reference

This reference is for developers building Laravel applications and the people deploying them, centering on Artisan, the CLI you run constantly. It covers scaffolding a project, generating models/controllers/migrations, running and rolling back migrations, boosting production with route/config/view caching, and handling background work with the queue. Unlike a generic Artisan command dump, entries are grouped by the workflow you actually repeat: create feature → migrate DB → run locally → cache for prod → queue the heavy work. After reading, you should be able to scaffold a CRUD feature, apply and roll back migrations cleanly, and be confident about what each cache command commits or clears.

Languages·40 commands·Last updated 2026-07-21
laravelphpframework

Project & Dev 10

laravel new project
Create a new project
php artisan serve
Start the dev server
php artisan make:model Post -mcr
Make model+migration+controller
php artisan make:migration create_posts_table
Create a migration
php artisan make:controller PostController
Create a controller
php artisan make:middleware CheckAge
Create middleware
php artisan make:request StorePostRequest
Create a form request
php artisan make:job ProcessPodcast
Create a queue job
php artisan make:event PodcastProcessed
Create an event
php artisan make:listener SendNotification
Create a listener

Database 8

php artisan migrate
Run migrations
php artisan migrate:fresh
Fresh: drop all and re-migrate
php artisan migrate:rollback
Rollback last migration
php artisan migrate:status
View migration status
php artisan db:seed
Run seeders
php artisan db:seed --class=UserSeeder
Run a specific seeder
php artisan make:seeder UserSeeder
Create a seeder
php artisan make:factory PostFactory
Create a factory

Routes & Cache 9

php artisan route:list
List all routes
php artisan route:cache
Cache routes (prod)
php artisan route:clear
Clear route cache
php artisan config:cache
Cache config
php artisan config:clear
Clear config cache
php artisan view:cache
Cache views
php artisan view:clear
Clear view cache
php artisan optimize
Optimize (config + routes)
php artisan optimize:clear
Clear all caches

Queues & Jobs 7

php artisan queue:work
Start the queue worker
php artisan queue:work --queue=high,default
Set queue priority
php artisan queue:restart
Restart all workers
php artisan queue:failed
List failed jobs
php artisan queue:retry <id>
Retry a failed job
php artisan queue:flush
Flush all failed jobs
php artisan make:job ProcessPodcast
Create a job class

Testing & Debug 6

php artisan test
Run tests
php artisan test --filter=UserTest
Run a specific test
php artisan tinker
Enter the REPL (tinker)
php artisan down
Enter maintenance mode
php artisan up
Exit maintenance mode
php artisan storage:link
Link the storage dir

Tips

  • In production always run php artisan optimize to cache config and routes.
  • make:model -mcr generates model+migration+resource controller at once.
  • Run queue workers under Supervisor to avoid unexpected exits.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us