Skip to content

Commit

Permalink
Add support for type option.
Browse files Browse the repository at this point in the history
  • Loading branch information
crynobone committed Apr 13, 2021
1 parent 789b3c2 commit 6f0b07a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Commands/Routing/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public function getStubFileName(): string
{
$stub = null;

if ($this->option('parent')) {
if ($type = $this->option('type')) {
$stub = "/stubs/controller.{$type}.stub";
} elseif ($this->option('parent')) {
$stub = 'controller.nested.stub';
} elseif ($this->option('model')) {
$stub = 'controller.model.stub';
Expand Down Expand Up @@ -121,6 +123,7 @@ protected function getOptions()
['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model.'],
['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class.'],
['resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class.'],
['type', null, InputOption::VALUE_REQUIRED, 'Manually specify the controller stub file to use.'],
];
}
}

0 comments on commit 6f0b07a

Please sign in to comment.