From 16766c44b15703cd2699426f22181ca262afa572 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Wed, 16 Aug 2023 06:27:59 +0800 Subject: [PATCH] wip Signed-off-by: Mior Muhammad Zaki --- src/GeneratesCommandCode.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GeneratesCommandCode.php b/src/GeneratesCommandCode.php index 479913b..262f82e 100644 --- a/src/GeneratesCommandCode.php +++ b/src/GeneratesCommandCode.php @@ -2,8 +2,10 @@ namespace Orchestra\Canvas\Core; +use Illuminate\Support\Str; + /** - * @see https://github.com/laravel/framework/blob/8.x/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php + * @see https://github.com/laravel/framework/blob/10.x/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php */ class GeneratesCommandCode extends GeneratesCode { @@ -16,6 +18,8 @@ protected function replaceClass(string $stub, string $name): string { $stub = parent::replaceClass($stub, $name); - return str_replace(['dummy:command', '{{ command }}', '{{command}}'], $this->options['command'], $stub); + $command = $this->options['command'] ?: 'app:'.Str::of($name)->classBasename()->kebab()->value(); + + return str_replace(['dummy:command', '{{ command }}', '{{command}}'], $command, $stub); } }