Hello Friends, Here we will see Laravel Artisan Commands. How many type of artisan command available in laravel and how can we use them. Laravel has set of commands for help developing your application . In the laravel we can also create custom artisan command.
Artisan is a command line interface included with laravel. Artisan exists at the root of your application as the artisan script and provides a number of helpful commands that can assist you while you build your application.
With the help of artisan commands we can easily and quickly develop our own application. Here below, I will mentioned often used command
1. you can check version of your laravel application by using below command.
php artisan --version
2. To view a list of all available artisan command, you can use.
php artisan list
1. Laravel Controller command.
1. To create a new controller php artisan make:controller DemoController 2. To create a new resource controller file. php artisan make:controller DemoController --resource // the controller will create inside the app/Http/Controllers directory Note: if you want to create controller inside any specific folder youb can use below command. 3. php artisan make:controller DemoFolderName\DemoController // the controller will create inside the app/Http/Controllers/DemoFolderName directory
4. To create a new middleware.
php artisan make:middleware TestMiddleware // the middleware will create inside the app/Http/Middleware directory
=> Models Related Command.
1.To Create a new models. php artisan make:model UserTest 2. To create a new model with migration. php artisan make:model UserTest -m 3. To create a new model with controller, migration. php artisan make:model TestModalName -c -m 4. To create a new model with resource controller, migration. php artisan make:model TestModalName -mcr
=> Larave Seeders Command.
1. To create Larave Seeders file. php artisan make:seeder UserSeeder 2. To Execute a specific seeder command. php artisan db:seed --class=UserSeeder 3. To Execute seeder command. php artisan db:seed
Laravel Notification command.
1. To create Laravel Notification. php artisan make:notification DemoNotification