Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Command/MailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(

protected function getStub(): string
{
return $this->getConfig()['stub'] ?? ($this->input->getOption('markdown') !== false ? __DIR__ . '/stubs/mail.stub' : __DIR__ . '/stubs/markdown-mail.stub');
return $this->getConfig()['stub'] ?? ($this->input->getOption('markdown') ? __DIR__ . '/stubs/markdown-mail.stub' : __DIR__ . '/stubs/mail.stub');
}

protected function getDefaultNamespace(): string
Expand Down Expand Up @@ -81,7 +81,7 @@ protected function getView(): string
{
$view = $this->input->getOption('markdown');

if (! $view) {
if (! is_string($view) || $view === '') {
$name = str_replace('\\', '/', $this->input->getArgument('name'));

$view = 'mail.' . collect(explode('/', $name))
Expand All @@ -103,7 +103,7 @@ protected function buildClass(string $name): string
parent::buildClass($name)
);

if ($this->input->getOption('markdown') !== false) {
if ($this->input->getOption('markdown')) {
$class = str_replace(['DummyView', '{{ view }}'], $this->getView(), $class);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ protected function sendMailable(MailableContract $mailable): ?SentMessage
/**
* Parse the given view name or array.
*/
protected function parseView(null|Closure|array|string $view): array
protected function parseView(null|Closure|Htmlable|HtmlString|array|string $view): array
{
if (is_string($view) || $view instanceof Closure) {
if (is_string($view) || $view instanceof Closure || $view instanceof Htmlable || $view instanceof HtmlString) {
return [$view, null, null];
}

Expand Down Expand Up @@ -315,7 +315,7 @@ protected function parseView(null|Closure|array|string $view): array
/**
* Add the content to a given message.
*/
protected function addContent(Message $message, null|Closure|string $view, null|Closure|string $plain, ?string $raw, array $data = []): void
protected function addContent(Message $message, null|Closure|Htmlable|HtmlString|string $view, null|Closure|Htmlable|HtmlString|string $plain, ?string $raw, array $data = []): void
{
if (isset($view)) {
$message->html($this->renderView($view, $data) ?: ' ');
Expand All @@ -333,7 +333,7 @@ protected function addContent(Message $message, null|Closure|string $view, null|
/**
* Render the given view.
*/
protected function renderView(Closure|string $view, array $data): string
protected function renderView(Closure|Htmlable|HtmlString|string $view, array $data): string
{
$view = value($view, $data);
if ($view instanceof Htmlable) {
Expand Down