<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
roerjo / laravel-notifications-sendgrid-driver example snippets
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['sendgrid'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Roerjo\LaravelNotificationsSendGridDriver\Messages\SendGridMailMessage
*/
public function toSendGrid($notifiable)
{
$accountId = $this->profile->account()->first()->id;
$channel = config("channels.{$this->profile->channel}.title");
return (new SendGridMailMessage)
->sendgrid([
'asm' => [
'group_id' => config('services.sendgrid.unsubscribe_groups.external')
],
])
->error()
->subject("We Need To Re-Authenticate Your {$channel} Profile")
->line("The token for your {$channel} profile is no longer valid.")
->action(
"Authenticate {$channel}",
url("accounts/{$accountId}/profiles")
)
->line('Thank you for helping us help you!');
}
use \Roerjo\LaravelNotificationsSendGridDriver\Messages\SendGridMailMessage;