Previewing mail notifications in Laravel just got easier
source link: https://sampo.co.uk/blog/previewing-mail-notifications-in-laravel-just-got-easier
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Previewing mail notifications in Laravel just got easier
Saturday, 18 May 2019
Since Laravel 5.8.16 the MailMessage
class created by a Mail Notification implements the Renderable
interface. This makes previewing it in a browser for testing much simpler. Rather than jumping through the hoops required before you can now do this:
Route::get('mail-preview', function () {
$invoice = App\Invoice::find(1);
return (new App\Notifications\InvoicePaid($invoice))
->toMail(null);
});
This is now much more in line with the ability to preview Mailable
classes in the browser.
Thanks to Avraham Appel for making the pull request to make this possible.
Share this article
Did you like this article? Share it on Facebook and Twitter. Don't forget to subscribe too.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK