Skip to content

Commit

Permalink
Create Notification make command markdown name placeholder from Notif… (
Browse files Browse the repository at this point in the history
laravel#52465)

* Create Notification make command markdown name placeholder from Notification name

* fix code style

* formatting

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
hosseinakbari-liefermia and taylorotwell authored Aug 13, 2024
1 parent 2d899e2 commit 320269a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Concerns\CreatesMatchingTest;
use Illuminate\Console\GeneratorCommand;
use Illuminate\Support\Str;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -143,7 +144,13 @@ protected function afterPromptingForMissingArguments(InputInterface $input, Outp
$wantsMarkdownView = confirm('Would you like to create a markdown view?');

if ($wantsMarkdownView) {
$markdownView = text('What should the markdown view be named?', 'E.g. invoice-paid');
$defaultMarkdownView = collect(explode('/', str_replace('\\', '/', $this->argument('name'))))
->map(fn ($path) => Str::kebab($path))
->prepend('mail')
->implode('.');

$markdownView = text('What should the markdown view be named?', default: $defaultMarkdownView);

$input->setOption('markdown', $markdownView);
}
}
Expand Down

0 comments on commit 320269a

Please sign in to comment.