MWZ

MINDWAREZONE

What is Artisan? Name some commonly used Artisan commands.

Artisan is the command-line interface (CLI) provided by Laravel. It helps developers automate repetitive tasks such as generating files, running migrations, clearing caches, and managing the application from the terminal.

Artisan comes built into Laravel, and you can access it using the php artisan command.

Commonly Used Artisan Commands

1. Start the Development Server

php artisan serve
            

Starts Laravel's local development server.

2. Create a Controller

php artisan make:controller UserController
            

Generates a new controller.

3. Create a Model

php artisan make:model Post
            

Creates a new Eloquent model.

4. Create a Migration

php artisan make:migration create_posts_table
            

Generates a migration file.

5. Run Migrations

php artisan migrate
            

Executes pending database migrations.

6. Roll Back the Last Migration

php artisan migrate:rollback
            

Reverts the most recent migration batch.

7. Create a Seeder

php artisan make:seeder UserSeeder
            

Generates a database seeder.

8. Run Seeders

php artisan db:seed
            

Populates the database with sample data.

9. Clear Application Cache

php artisan cache:clear
            

Clears the application cache.

10. Clear Configuration Cache

php artisan config:clear
            

Removes the cached configuration.

11. Cache Configuration

php artisan config:cache
            

Caches configuration files for better performance.

12. List All Artisan Commands

php artisan list