Generating Commands

Updated on Jul 11, 2024

Next are commands that allow you to create new classes, commands, or views directly into your application, straight from the CLI. Below are all the commands that allow you to do those things.

  • php artisan make:cast - Create a new custom Eloquent cast class;
  • php artisan make:channel - Create a new channel class;
  • php artisan make:command - Create a new Artisan command;
  • php artisan make:component - Create a new view component class;
  • php artisan make:controller - Create a new controller class;
  • php artisan make:event - Create a new event class;
  • php artisan make:exception - Create a new custom exception class;
  • php artisan make:factory - Create a new model factory;
  • php artisan make:job - Create a new job class;
  • php artisan make:listener - Create a new event listener class;
  • php artisan make:mail - Create a new email class;
  • php artisan make:middleware - Create a new middleware class;
  • php artisan make:migration - Create a new migration file;
  • php artisan make:model - Create a new Eloquent model class;
  • php artisan make:notification - Create a new notification class;
  • php artisan make:observer - Create a new observer class;
  • php artisan make:policy - Create a new policy class;
  • php artisan make:provider - Create a new service provider class;
  • php artisan make:request - Create a new form request class;
  • php artisan make:resource - Create a new resource;
  • php artisan make:rule - Create a new validation rule;
  • php artisan make:scope - Create a new scope class;
  • php artisan make:seeder - Create a new seeder class;
  • php artisan make:test - Create a new test class;
  • php artisan make:view - Create a new view.

That is a lot of commands, but they are all instrumental. You must assign a name to the new item you are creating to use each of them. Simply append it to the end of the command; that is it. Once you have created your item, you can start working on it without setting it up again. 

Those are the generation commands that Laravel offers, and they cover almost everything you need to develop your application.

On this page...