Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit 18ee5e9

Browse files
author
atehnix
committed
Add markdown stub
1 parent 44261ec commit 18ee5e9

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

src/Console/MailMakeCommand.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,26 @@ protected function getDefaultNamespace($rootNamespace)
4242
{
4343
return $rootNamespace . $this->getModuleNamespace() . config('stubs.namespaces.mail');
4444
}
45+
46+
/**
47+
* Write the Markdown template for the mailable.
48+
*
49+
* @return void
50+
*/
51+
protected function writeMarkdownTemplate()
52+
{
53+
$path = resource_path('views/' . str_replace('.', '/', $this->option('markdown'))) . '.blade.php';
54+
55+
if (!$this->files->isDirectory(dirname($path))) {
56+
$this->files->makeDirectory(dirname($path), 0755, true);
57+
}
58+
59+
$stub = config('stubs.path') . '/markdown.stub';
60+
61+
if (file_exists($stub)) {
62+
$this->files->put($path, file_get_contents($stub));
63+
} else {
64+
parent::writeMarkdownTemplate();
65+
}
66+
}
4567
}

src/Console/NotificationMakeCommand.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,26 @@ protected function getDefaultNamespace($rootNamespace)
4242
{
4343
return $rootNamespace . $this->getModuleNamespace() . config('stubs.namespaces.notification');
4444
}
45+
46+
/**
47+
* Write the Markdown template for the mailable.
48+
*
49+
* @return void
50+
*/
51+
protected function writeMarkdownTemplate()
52+
{
53+
$path = resource_path('views/' . str_replace('.', '/', $this->option('markdown'))) . '.blade.php';
54+
55+
if (!$this->files->isDirectory(dirname($path))) {
56+
$this->files->makeDirectory(dirname($path), 0755, true);
57+
}
58+
59+
$stub = config('stubs.path') . '/markdown.stub';
60+
61+
if (file_exists($stub)) {
62+
$this->files->put($path, file_get_contents($stub));
63+
} else {
64+
parent::writeMarkdownTemplate();
65+
}
66+
}
4567
}

src/Console/StubsPublishCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class StubsPublishCommand extends Command
6767
'Illuminate/Foundation/Console/stubs/mail.stub',
6868
'Illuminate/Foundation/Console/stubs/markdown-mail.stub',
6969
'Illuminate/Foundation/Console/stubs/markdown-notification.stub',
70+
'Illuminate/Foundation/Console/stubs/markdown.stub',
7071
'Illuminate/Foundation/Console/stubs/model.stub',
7172
'Illuminate/Foundation/Console/stubs/notification.stub',
7273
'Illuminate/Foundation/Console/stubs/observer.stub',

0 commit comments

Comments
 (0)