Skip to content

Instantly share code, notes, and snippets.

@MrAtiebatie
Created September 20, 2019 10:45
Show Gist options
  • Save MrAtiebatie/b015d7061619df6507125b027d32b5ef to your computer and use it in GitHub Desktop.
Save MrAtiebatie/b015d7061619df6507125b027d32b5ef to your computer and use it in GitHub Desktop.
Rendering on demand notifications
<?php
use Illuminate\Notifications\AnonymousNotifiable;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
$router->get('/notification', function () {
$user = new AnonymousNotifiable;
$notification = (new \App\Notifications\InvoicePaid)->toMail($user->route('mail', ['[email protected]']));
$markdown = new \Illuminate\Mail\Markdown(view(), config('mail.markdown'));
return $markdown->render($notification->markdown, $notification->data());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment