diff --git a/src/Console/MailMakeCommand.php b/src/Console/MailMakeCommand.php index e668ea9..f81c0e9 100644 --- a/src/Console/MailMakeCommand.php +++ b/src/Console/MailMakeCommand.php @@ -42,4 +42,26 @@ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace . $this->getModuleNamespace() . config('stubs.namespaces.mail'); } + + /** + * Write the Markdown template for the mailable. + * + * @return void + */ + protected function writeMarkdownTemplate() + { + $path = resource_path('views/' . str_replace('.', '/', $this->option('markdown'))) . '.blade.php'; + + if (!$this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0755, true); + } + + $stub = config('stubs.path') . '/markdown.stub'; + + if (file_exists($stub)) { + $this->files->put($path, file_get_contents($stub)); + } else { + parent::writeMarkdownTemplate(); + } + } } diff --git a/src/Console/NotificationMakeCommand.php b/src/Console/NotificationMakeCommand.php index 30b320f..a63b2ed 100644 --- a/src/Console/NotificationMakeCommand.php +++ b/src/Console/NotificationMakeCommand.php @@ -42,4 +42,26 @@ protected function getDefaultNamespace($rootNamespace) { return $rootNamespace . $this->getModuleNamespace() . config('stubs.namespaces.notification'); } + + /** + * Write the Markdown template for the mailable. + * + * @return void + */ + protected function writeMarkdownTemplate() + { + $path = resource_path('views/' . str_replace('.', '/', $this->option('markdown'))) . '.blade.php'; + + if (!$this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0755, true); + } + + $stub = config('stubs.path') . '/markdown.stub'; + + if (file_exists($stub)) { + $this->files->put($path, file_get_contents($stub)); + } else { + parent::writeMarkdownTemplate(); + } + } } diff --git a/src/Console/StubsPublishCommand.php b/src/Console/StubsPublishCommand.php index f458fea..db5d95a 100644 --- a/src/Console/StubsPublishCommand.php +++ b/src/Console/StubsPublishCommand.php @@ -67,6 +67,7 @@ class StubsPublishCommand extends Command 'Illuminate/Foundation/Console/stubs/mail.stub', 'Illuminate/Foundation/Console/stubs/markdown-mail.stub', 'Illuminate/Foundation/Console/stubs/markdown-notification.stub', + 'Illuminate/Foundation/Console/stubs/markdown.stub', 'Illuminate/Foundation/Console/stubs/model.stub', 'Illuminate/Foundation/Console/stubs/notification.stub', 'Illuminate/Foundation/Console/stubs/observer.stub',