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

Commit

Permalink
Add markdown stub
Browse files Browse the repository at this point in the history
  • Loading branch information
atehnix committed Apr 2, 2019
1 parent 44261ec commit 18ee5e9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Console/MailMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
22 changes: 22 additions & 0 deletions src/Console/NotificationMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
1 change: 1 addition & 0 deletions src/Console/StubsPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 18ee5e9

Please sign in to comment.