diff --git a/src/Command/MailCommand.php b/src/Command/MailCommand.php index 3fe18ca..b814921 100644 --- a/src/Command/MailCommand.php +++ b/src/Command/MailCommand.php @@ -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 @@ -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)) @@ -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); } diff --git a/src/Mailer.php b/src/Mailer.php index b39087f..7579cee 100644 --- a/src/Mailer.php +++ b/src/Mailer.php @@ -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]; } @@ -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) ?: ' '); @@ -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) {