Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Add renderable functionality to MailMessage #28386

Merged
merged 3 commits into from
May 2, 2019
Merged
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
17 changes: 16 additions & 1 deletion src/Illuminate/Notifications/Messages/MailMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
namespace Illuminate\Notifications\Messages;

use Traversable;
use Illuminate\Mail\Markdown;
use Illuminate\Container\Container;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Renderable;

class MailMessage extends SimpleMessage
class MailMessage extends SimpleMessage implements Renderable
{
/**
* The view to be rendered.
Expand Down Expand Up @@ -271,4 +274,16 @@ protected function arrayOfAddresses($address)
$address instanceof Arrayable ||
$address instanceof Traversable;
}

/**
* Render the mail object into an HTML string.
*
* @return string
*/
public function render()
{
return Container::getInstance()
->make(Markdown::class)
->render($this->markdown, $this->data());
}
}