Skip to content

Commit

Permalink
fix formatting. fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 3, 2018
1 parent e5fa9e4 commit dcc6123
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Routing/Console/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ protected function getStub()
$stub = '/stubs/controller.stub';
}

if ($this->option('api') && $stub !== null) {
$stub = substr_replace($stub, '.api', -5, 0);
if ($this->option('api') && is_null($stub)) {
$stub = '/stubs/controller.api.stub';
} elseif ($this->option('api') && ! is_null($stub)) {
$stub = str_replace('.stub', '.api.stub', $stub);
}

$stub = $stub ?? '/stubs/controller.plain.stub';
Expand Down Expand Up @@ -176,7 +178,7 @@ protected function getOptions()

['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class.'],

['api', 'a', InputOption::VALUE_NONE, 'Generate api resource methods only for a controller class.'],
['api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller.'],
];
}
}

0 comments on commit dcc6123

Please sign in to comment.