Artisan is a command-line interface that Laravel provides which helps in making the production process fast and easy. Laravel has its own Command Line interface called Artisan. Its like a Linux command line but the commands are helpful for building a Laravel application. With this command-line tool, we can make models, controllers, and can do data migrations and many more. First, we will have to change the directory in your command line console (i.e. cmd on windows or terminal on Linux/Mac) or any other CLI software, to the directory of your Laravel app.
For Controller: The following command will create a controller:
php artisan make:controller ArticleController
Command below is to create a controller and a model together:
php artisan make:controller ArticleController -m Article
For Eloquent Model: The following command will create a eloquent model:
php artisan make:model Article
For Front-end Scaffolding: The following command will create a front-end scaffolding for the for Bootstrap:
php artisan ui bootstrap
The following command will create a front-end scaffolding for the for Vue:
php artisan ui vue
The following command will create a front-end scaffolding for the for React:
php artisan ui react
To remove the scaffolding, use the below command:
php artisan preset none
Note: You will need to run ‘composer require laravel/ui –dev’ for installing ‘laravel/ui’ package before using the above command.
For Authentication Configuration: The following command will create a full authentication system:
php artisan ui vue --auth
For Migration: The following command will create a migration:
php artisan make:migration create_articles_table
To do database migration for all the tables, run the command below:
php artisan migrate
For Route: The following command will display list of all the routes:
php artisan route:list
For Tinker: The following command will start tinker:
php artisan tinker
For Starting Development Server: The following command will start the Laravel development server and provide a URL to visit the running Laravel application:
php artisan serve
For Maintenance Mode: The following command can be used to take the Laravel application in or out of the Maintenance Mode:
php artisan down
Out of Maintenance:
php artisan up
For Listing Commands: The following command will display a list of all the command that are available:
php artisan list
You can also write juts ‘php artisan’ without ‘list’ and will work the same and list out all the artisan commands.
Note: To know more about any command, use -h or –help at the end of the command.
- Laravel | Artisan Console Introduction
- Laravel | CSRF Protection
- Laravel | Validation Rules
- Laravel | Directory Structure
- Laravel | Installation and Configuration
- Laravel | Routing Basics
- Laravel | Front-end Scaffolding
- Differences Between Django vs Laravel
- Laravel | Delete Records
- Laravel | Controller Basics
- Laravel | View Basics
- Laravel | Migration Basics
- Laravel | MySQL Database Connection
- Laravel | Blade Templates Inheritance
- Difference Between Laravel and Ruby on Rails
- Laravel | Eloquent Model Basics
- Difference Between Laravel and CodeIgniter Framework in PHP
- What are the differences and Similarities Between Lumen and Laravel?
- Different ways for passing data to view in Laravel
- Which One is Most Demanding Back-End Web Framework between Laravel , NodeJS and Django ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.