Skip to content

Commit

Permalink
fix mailchannel
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Dec 2, 2017
1 parent a9ccc27 commit 1973bd0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Illuminate/Notifications/Channels/MailChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function buildView($message)
*/
protected function buildMessage($mailMessage, $notifiable, $notification, $message)
{
$this->addressMessage($mailMessage, $notifiable, $message);
$this->addressMessage($mailMessage, $notifiable, $message, $notification);

$mailMessage->subject($message->subject ?: Str::title(
Str::snake(class_basename($notification), ' ')
Expand All @@ -128,13 +128,14 @@ protected function buildMessage($mailMessage, $notifiable, $notification, $messa
* @param \Illuminate\Mail\Message $mailMessage
* @param mixed $notifiable
* @param \Illuminate\Notifications\Messages\MailMessage $message
* @param \Illuminate\Notifications\Notification $notification
* @return void
*/
protected function addressMessage($mailMessage, $notifiable, $message)
protected function addressMessage($mailMessage, $notifiable, $message, $notification)
{
$this->addSender($mailMessage, $message);

$mailMessage->to($this->getRecipients($notifiable, $message));
$mailMessage->to($this->getRecipients($notifiable, $message, $notification));

if ($message->cc) {
$mailMessage->cc($message->cc[0], Arr::get($message->cc, 1));
Expand Down Expand Up @@ -168,11 +169,12 @@ protected function addSender($mailMessage, $message)
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Messages\MailMessage $message
* @param \Illuminate\Notifications\Notification $notification
* @return mixed
*/
protected function getRecipients($notifiable, $message)
protected function getRecipients($notifiable, $message, $notification)
{
if (is_string($recipients = $notifiable->routeNotificationFor('mail'))) {
if (is_string($recipients = $notifiable->routeNotificationFor('mail', $notification))) {
$recipients = [$recipients];
}

Expand Down

0 comments on commit 1973bd0

Please sign in to comment.