Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Aug 15, 2023
1 parent 1d616b8 commit 16766c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/GeneratesCommandCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
}
}

0 comments on commit 16766c4

Please sign in to comment.