namespace App\Notifications;
use Illuminate\Notifications\Notification;
use NotificationChannels\SendGrid\SendGridChannel;
class ExampleNotification extends Notification
{
public function via($notifiable)
{
return [
SendGridChannel::class,
// And any other channels you want can go here...
];
}
// ...
public function toSendGrid($notifiable)
{
return (new SendGridMessage('Your SendGrid template ID'))
/**
* optionally set the from address.
* by default this comes from config/mail.from
* ->from('[email protected]', 'App name')
*/
/**
* optionally set the recipient.
* by default it's $notifiable->routeNotificationFor('mail')
* ->to('[email protected]', 'Mr. Smith')
*/
->payload([
"template_var_1" => "template_value_1"
]);
}
}