Previewing mail notifications in Laravel just got easier
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.