diff --git a/src/Commands/MakePolicyCommand.php b/src/Commands/MakePolicyCommand.php index 3862adf..741ddb2 100644 --- a/src/Commands/MakePolicyCommand.php +++ b/src/Commands/MakePolicyCommand.php @@ -27,13 +27,16 @@ public function handle(): int { $modelPath = is_dir(app_path('Models')) ? app_path('Models') : app_path(); - $className = suggest( - 'Model', - collect((new Finder())->files()->depth(0)->in($modelPath)) - ->map(static fn ($file) => $file->getBasename('.php')) - ->values() - ->all() - ); + if (! $className = $this->argument('className')) { + $className = suggest( + label: 'Model', + options: collect((new Finder())->files()->depth(0)->in($modelPath)) + ->map(static fn ($file) => $file->getBasename('.php')) + ->values() + ->all(), + required: true, + ); + } $model = $this->qualifyModel($className); $className = class_basename($model) . "Policy";