Skip to content

Commit

Permalink
[8.x] Add type option to make controller (laravel#36853)
Browse files Browse the repository at this point in the history
* Add type option to make controller

* Update ControllerMakeCommand.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
dillingham and taylorotwell authored Apr 2, 2021
1 parent f05f390 commit 663b5b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Illuminate/Routing/Console/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ protected function getStub()
{
$stub = null;

if ($this->option('parent')) {
if ($type = $this->option('type')) {
$stub = "/stubs/controller.{$type}.stub";
} elseif ($this->option('parent')) {
$stub = '/stubs/controller.nested.stub';
} elseif ($this->option('model')) {
$stub = '/stubs/controller.model.stub';
Expand Down Expand Up @@ -195,6 +197,7 @@ protected function getOptions()
{
return [
['api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller.'],
['type', null, InputOption::VALUE_REQUIRED, 'Manually specify the controller stub file to use.'],
['force', null, InputOption::VALUE_NONE, 'Create the class even if the controller already exists'],
['invokable', 'i', InputOption::VALUE_NONE, 'Generate a single method, invokable controller class.'],
['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model.'],
Expand Down

0 comments on commit 663b5b3

Please sign in to comment.