Laravel provides various Artisan commands under the make:
namespace which allows creating empty controllers, models, listeners, providers and many other types of classes. This means that we don't need to manually create the files and write repetitive code.
We can execute the following command to get a list of the Artisan make
commands:
php artisan list make
Some of the Artisan make
commands have arguments and options. We can check them with the --help
option:
php artisan make:provider --help
Artisan make
commands are summarized in the following table:
No. | Command | Used to create | Available since |
---|---|---|---|
1. | make:cast | Custom Eloquent cast class | 7.10.0 |
2. | make:channel | Channel class | 5.6.0 |
3. | make:command | Artisan command | 5.0.0* |
4. | make:component | View component class | 7.0.0 |
5. | make:controller | Controller class | 5.0.0* |
6. | make:event | Event class | 5.0.0 |
7. | make:exception | Custom exception class | 5.5.14 |
8. | make:factory | Model factory | 5.5.0 |
9. | make:job | New job class | 5.1.0 |
10. | make:listener | Event listener class | 5.1.0 |
11. | make:mail | Email class | 5.3.0 |
12. | make:middleware | Middleware class | 5.0.0 |
13. | make:migration | Migration file | 5.0.0* |
14. | make:model | Eloquent model class | 5.0.0 |
15. | make:notification | Notification class | 5.3.0 |
16. | make:observer | Observer class | 5.6.24 |
17. | make:policy | Policy class | 5.1.11 |
18. | make:provider | Service provider class | 5.0.0 |
19. | make:request | Form request class | 5.0.0 |
20. | make:resource | Resource | 5.5.0 |
21. | make:rule | Validation rule | 5.5.0 |
22. | make:seeder | Seeder class | 5.1.0 |
23. | make:test | Test class | 5.1.17 |
* Command under the make:
namespace available since Laravel 5.0.0. Previously, command was available with different namespace.
Leave a Comment
Cancel reply