From 82fd1c7eb0a1a4971acfca4e56e746765f33fc8c Mon Sep 17 00:00:00 2001 From: Andy Hinkle Date: Sun, 6 Mar 2022 12:58:31 -0600 Subject: [PATCH] Allow nested markdown files for mailables --- src/Illuminate/Foundation/Console/MailMakeCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Console/MailMakeCommand.php b/src/Illuminate/Foundation/Console/MailMakeCommand.php index c3d4b27cb46e..b50050c09b65 100644 --- a/src/Illuminate/Foundation/Console/MailMakeCommand.php +++ b/src/Illuminate/Foundation/Console/MailMakeCommand.php @@ -102,7 +102,11 @@ protected function getView() $view = $this->option('markdown'); if (! $view) { - $view = 'mail.'.Str::kebab(class_basename($this->argument('name'))); + $name = str_replace('\\', '/', $this->argument('name')); + + $view = 'mail.'.collect(explode('/', $name)) + ->map(fn ($part) => Str::kebab($part)) + ->implode('.'); } return $view;