diff --git a/src/Commands/HydeMakePageCommand.php b/src/Commands/HydeMakePageCommand.php index 9ee67352..f06c1f64 100644 --- a/src/Commands/HydeMakePageCommand.php +++ b/src/Commands/HydeMakePageCommand.php @@ -2,6 +2,7 @@ namespace Hyde\Framework\Commands; +use Exception; use LaravelZero\Framework\Commands\Command; /** @@ -61,21 +62,14 @@ public function handle(): int */ protected function validateOptions(): void { - $title = $this->argument('title'); + $this->title = $this->argument('title'); + $type = $this->option('type') ?? 'markdown'; if (!in_array($type, ['markdown', 'blade'])) { - $this->error("Invalid page type: $type"); - exit(1); + throw new Exception("Invalid page type: $type", 400); } - if (empty($title)) { - $this->error('You must specify a title for the page'); - exit(1); - } - - $this->title = $title; - // Set the type to the fully qualified class name if ($type === 'markdown') { $this->type = \Hyde\Framework\Models\MarkdownPage::class;