Milind Daraniya

A Comprehensive Guide to Laravel Artisan Make Commands

Published October 3rd, 2023 25 min read

Laravel's Artisan command-line tool is a developer's best friend when it comes to automating repetitive tasks and speeding up your workflow. In this guide, we'll dive into a comprehensive list of essential make commands provided by Laravel Artisan. These commands empower you to generate boilerplate code, scaffold components, and set up your project structure effortlessly.

1. Creating Controllers

php artisan make:controller MyController

2. Generating Models

php artisan make:model MyModel

3. Crafting Migrations

php artisan make:migration create_table_name

4. Generating Factory

php artisan make:factory MyFactory

5. Creating Seeders

php artisan make:seeder MySeeder

6. Generating Middleware

php artisan make:middleware MyMiddleware

7. Crafting Requests

php artisan make:request MyRequest

8. Creating Providers

php artisan make:provider MyProvider

9. Generating Artisan Commands

php artisan make:command MyCommand

10. Crafting Event Listeners

php artisan make:listener MyListener

11. Creating Notifications

php artisan make:notification MyNotification

12. Generating Policies

php artisan make:policy MyPolicy

13. Crafting Events

php artisan make:event MyEvent

14. Creating Jobs

php artisan make:job MyJob

15. Generating Resources

php artisan make:resource MyResource

16. Crafting Channels (WebSockets)

php artisan make:channel MyChannel

17. Creating Livewire Components

php artisan make:livewire MyLivewireComponent

18. Generating Notifications

php artisan make:notification MyNotification

19. Crafting Factories for Models

php artisan make:factory MyModelFactory --model=MyModel

20. Creating Test Cases

php artisan make:test MyTest

By mastering these make commands, you can significantly accelerate your Laravel development process. Whether you're a seasoned Laravel developer or just getting started, these commands will become your go-to tools for quickly generating the foundational elements of your application.