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

make:controller

Create a new controller class

Options

  • api - Exclude the create and edit methods from the controller. Optional
  • type - Manually specify the controller stub file to use. Required
  • force - Create the class even if the controller already exists Optional
  • invokable - Generate a single method, invokable controller class. Optional
  • model - Generate a resource controller for the given model. Optional
  • parent - Generate a nested resource controller class. Optional
  • resource - Generate a resource controller class. Optional
  • requests - Generate FormRequest classes for store and update. Optional
  • test - Generate an accompanying PHPUnit test for the Controller Optional
  • pest - Generate an accompanying Pest test for the Controller Optional

Arguments

  • name - The name of the class Required
php artisan make:controller [--api] [--type TYPE] [--force] [-i|--invokable] [-m|--model [MODEL]] [-p|--parent [PARENT]] [-r|--resource] [-R|--requests] [--test] [--pest] [--] <name>