From 6f0b07a374691689e73e458670bba2b943c8cf41 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 13 Apr 2021 22:46:11 +0800 Subject: [PATCH] Add support for type option. see laravel/framework#36853 --- src/Commands/Routing/Controller.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Commands/Routing/Controller.php b/src/Commands/Routing/Controller.php index b9410ec2..28af5d4a 100644 --- a/src/Commands/Routing/Controller.php +++ b/src/Commands/Routing/Controller.php @@ -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'; @@ -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.'], ]; } }