From 63d828de2d1b9bf228a9d452deab2fcf98fac4d9 Mon Sep 17 00:00:00 2001 From: hossein Date: Tue, 13 Aug 2024 13:55:46 +0330 Subject: [PATCH 1/3] Create Notification make command markdown name placeholder from Notification name --- .../Foundation/Console/NotificationMakeCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Console/NotificationMakeCommand.php b/src/Illuminate/Foundation/Console/NotificationMakeCommand.php index 2cc6a4d96e1..3ee978e0ae3 100644 --- a/src/Illuminate/Foundation/Console/NotificationMakeCommand.php +++ b/src/Illuminate/Foundation/Console/NotificationMakeCommand.php @@ -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; @@ -143,7 +144,10 @@ 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)) + ->implode('/'); + $markdownView = text('What should the markdown view be named?', "E.g. {$defaultMarkdownView}"); $input->setOption('markdown', $markdownView); } } From 290bb4eaa749418988635b838c11e8a5e9bce396 Mon Sep 17 00:00:00 2001 From: hossein Date: Tue, 13 Aug 2024 14:22:36 +0330 Subject: [PATCH 2/3] fix code style --- src/Illuminate/Foundation/Console/NotificationMakeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Console/NotificationMakeCommand.php b/src/Illuminate/Foundation/Console/NotificationMakeCommand.php index 3ee978e0ae3..893d71bb30b 100644 --- a/src/Illuminate/Foundation/Console/NotificationMakeCommand.php +++ b/src/Illuminate/Foundation/Console/NotificationMakeCommand.php @@ -145,7 +145,7 @@ protected function afterPromptingForMissingArguments(InputInterface $input, Outp if ($wantsMarkdownView) { $defaultMarkdownView = collect(explode('/', str_replace('\\', '/', $this->argument('name')))) - ->map(fn($path) => Str::kebab($path)) + ->map(fn ($path) => Str::kebab($path)) ->implode('/'); $markdownView = text('What should the markdown view be named?', "E.g. {$defaultMarkdownView}"); $input->setOption('markdown', $markdownView); From 007f809d78eb126d4d63b7e463bb63baab981945 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 13 Aug 2024 07:29:14 -1000 Subject: [PATCH 3/3] formatting --- .../Foundation/Console/NotificationMakeCommand.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Console/NotificationMakeCommand.php b/src/Illuminate/Foundation/Console/NotificationMakeCommand.php index 893d71bb30b..d6105af9192 100644 --- a/src/Illuminate/Foundation/Console/NotificationMakeCommand.php +++ b/src/Illuminate/Foundation/Console/NotificationMakeCommand.php @@ -146,8 +146,11 @@ protected function afterPromptingForMissingArguments(InputInterface $input, Outp if ($wantsMarkdownView) { $defaultMarkdownView = collect(explode('/', str_replace('\\', '/', $this->argument('name')))) ->map(fn ($path) => Str::kebab($path)) - ->implode('/'); - $markdownView = text('What should the markdown view be named?', "E.g. {$defaultMarkdownView}"); + ->prepend('mail') + ->implode('.'); + + $markdownView = text('What should the markdown view be named?', default: $defaultMarkdownView); + $input->setOption('markdown', $markdownView); } }