Permalink
Browse files

add some meta data to the notification mails

  • Loading branch information...
taylorotwell committed Oct 4, 2018
1 parent 763b64a commit 477273c72be8b253b6421c69f3e37b5bf4c3a185
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/Illuminate/Notifications/Channels/MailChannel.php
@@ -8,6 +8,7 @@
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Contracts\Mail\Mailable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailChannel
{
@@ -60,7 +61,7 @@ public function send($notifiable, Notification $notification)
$this->mailer->send(
$this->buildView($message),
$message->data(),
array_merge($message->data(), $this->additionalMessageData($notification)),
$this->messageBuilder($notifiable, $notification, $message)
);
}
@@ -98,6 +99,22 @@ protected function buildView($message)
];
}
/**
* Get additional meta-data to pass along with the view data.
*
* @param \Illuminate\Notifications\Notification $notification
* @return array
*/
protected function additionalMessageData($notification)
{
return [
'__laravel_notification' => get_class($notification),
'__laravel_notification_queued' => in_array(
ShouldQueue::class, class_implements($notification)
),
];
}
/**
* Build the mail message.
*

0 comments on commit 477273c

Please sign in to comment.