Introduction to Artisan
Artisan is the console command line interface included with Laravel Framework. Artisan provides a number of helpful commands that can assist you while you build your Laravel application.
How to use commands?
To view list of available Artisan commands by following command.
Each command also includes a “help” screen which displays and describes the command’s available arguments and options. We can view a help screen the name of the command with help
Available Aartisan console commands with description.
Below some most common uses commands with details:
Every time when we run different commands on the Laravel application laravel framework generates automatic some cache files in bootstrap/cache folder. Those files are compiled.php and services.php. Both of them file keeps list of mostly used classes/services needed by your project configuration. This php artisan clear-compiled command removes all the files from cache folder.
To enable maintenance mode, we need to execute the down Artisan command: php artisan down Put the application into maintenance mode.
To disable maintenance mode, we need to execute the up Artisan command: php artisan up Bring the application out of maintenance mode.
Create Local Development Server by artisan serve command php artisan serve The serve command is used to run the application using the PHP development server. This command is generally used for development and testing purposes.
To generating migrations for database each table migration file name contains a timestamp which allows Laravel to determine the order of the migrations php artisan make:migration create_users_table migration file created on “database\migrations” directory. We can use the –path option when executing the make:migration command, If we would like to specify a custom output path for the generated migration.
Laravel artisan db:seed command is used to add records to a database automatically using a Seeder Illuminate\Database\Seeder class to generate or provide the records. For the db:seed defines three options: class, database and force. By default the db:seed command will use for the DatabaseSeeder class, this class is defines in the project root database/seeds/DatabaseSeeder.php file. Importance seeder commands are below.
The user auth:clear-resets command can be used to remove expired password reset tokens from the database.
Flush the application cache.
Remove an item from the cache.
Create a migration for the cache database table.
Create a cache file for faster configuration loading.
Remove the configuration cache file.
Discover and cache the application’s events and listeners.
Clear all cached events and listeners.
Generate the missing events and listeners based on regist.
Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with me. Please LIKE and SHARE