Laravel Artisan Commands
1 min readMay 5, 2021
Laravel comes with many predefined commands which make easy work for the developer. Using that command you can fulfill your requirements
- To generate the controller run the below command
php artisan make:controller <controller name>
- To generate the resource controller run the below command
php artisan make:controller <controller name> --resource
- To generate the model run the below command
php artisan make:model <model name>
- To generate the migration run the below command
php artisan make:migration <migration name>
- To generate the request run the below command
php artisan make:request <request name>
- To create a mailable class run the below command
php artisan make:mail <mailable class name>
- To create a custom artisan command run the below command
php artisan make:command <command name>
- To clear the cache run the below command
php artisan cache:clear
- To make all configuration into a single file to loaded quickly run the bellow command
php artisan config:cache
If you are using the
config:cache
command during deployment, you must make sure that you are only calling theenv
function from within your configuration files, and not from anywhere else in your application.
- To clear all Laravel caches run the below command
php artisan optimize:clear
There are many other commands provided by Laravel. But above commands are used on regular basis.