5 Laravel Artisan commands I use every single day
If you're a Laravel dev, these five are probably burned into your terminal history too:
-
php artisan make:model Post -mfsc
Model + migration + factory + seeder + controller, one command. No more typing five separatemake:commands like it's 2015. -
php artisan tinker
Need to test a query or poke at a relationship real quick? Tinker over spinning up a whole route, every time. -
php artisan route:list --path=api
Debugging a 404 or checking if middleware actually applied? This shows you instantly, no guessing. -
php artisan queue:work --tries=3
Can't run jobs without this. That--triesflag has saved me from silently-failed jobs more than once. -
php artisan optimize:clear
Something "just not updating"? Config, cache, routes, views? This is step zero before real debugging even starts.
Drop your most-used Artisan command below β curious what I'm missing π
Top comments (2)
make:model -mfscis the one I'd put first too β the failure mode without it is a half-scaffolded model that passes review and then breaks on the first seeder run. For tinker, I get more mileage out of a small non-interactive snippet than the shell when I'm testing one relationship, because it's reproducible and I can paste it into an issue.One I'd add:
php artisan db:show --countswhen you inherit a database nobody documented. It tells you which tables are actually populated before you write a query against an empty one. Do you keep a project-specific Artisan command in your repos, or is needing one a sign the codebase has outgrown the framework defaults?Good addition β db:show --counts is a nice one, especially for that "inherited chaos" scenario where you don't want to trust the schema without checking what's actually populated.