The Laravel Artisan Cheatsheet now has an API. Learn more.

make:model

Create a new Eloquent model class

Options

  • all - Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model Optional
  • controller - Create a new controller for the model Optional
  • factory - Create a new factory for the model Optional
  • force - Create the class even if the model already exists Optional
  • migration - Create a new migration file for the model Optional
  • morph-pivot - Indicates if the generated model should be a custom polymorphic intermediate table model Optional
  • policy - Create a new policy for the model Optional
  • seed - Create a new seeder for the model Optional
  • pivot - Indicates if the generated model should be a custom intermediate table model Optional
  • resource - Indicates if the generated controller should be a resource controller Optional
  • api - Indicates if the generated controller should be an API resource controller Optional
  • requests - Create new form request classes and use them in the resource controller Optional
  • test - Generate an accompanying PHPUnit test for the Model Optional
  • pest - Generate an accompanying Pest test for the Model Optional

Arguments

  • name - The name of the model Required
php artisan make:model [-a|--all] [-c|--controller] [-f|--factory] [--force] [-m|--migration] [--morph-pivot] [--policy] [-s|--seed] [-p|--pivot] [-r|--resource] [--api] [-R|--requests] [--test] [--pest] [--] <name>