diff --git a/src/Laravel/src/Commands/MakeResourceCommand.php b/src/Laravel/src/Commands/MakeResourceCommand.php index b3e00a1ca..c3413c771 100644 --- a/src/Laravel/src/Commands/MakeResourceCommand.php +++ b/src/Laravel/src/Commands/MakeResourceCommand.php @@ -41,11 +41,18 @@ public function handle(): int $this->makeDir($resourcesDir); - $stub = select('Resource type', [ + $types = [ 'ModelResourceDefault' => 'Default model resource', 'ModelResourceWithPages' => 'Model resource with pages', 'Resource' => 'Empty resource', - ], 'ModelResourceDefault'); + ]; + + if ($type = $this->option('type')) { + $keys = array_keys($types); + $stub = $keys[$type - 1] ?? $keys[0]; + } else { + $stub = select('Resource type', $types, 'ModelResourceDefault'); + } $replace = [ '{namespace}' => moonshineConfig()->getNamespace('\Resources'),