/**
  * Send the given notification.
  *
  * @param  mixed  $notifiable
  * @param  \Illuminate\Notifications\Notification  $notification
  * @return void
  */
 public function send($notifiable, Notification $notification)
 {
     if (!$notifiable->routeNotificationFor('mail')) {
         return;
     }
     $message = $notification->toMail($notifiable);
     if ($message instanceof Mailable) {
         return $message->send($this->mailer);
     }
     $this->mailer->send($message->view, $message->data(), function ($m) use($notifiable, $notification, $message) {
         $recipients = empty($message->to) ? $notifiable->routeNotificationFor('mail') : $message->to;
         if (!empty($message->from)) {
             $m->from($message->from[0], isset($message->from[1]) ? $message->from[1] : null);
         }
         if (is_array($recipients)) {
             $m->bcc($recipients);
         } else {
             $m->to($recipients);
         }
         $m->subject($message->subject ?: Str::title(Str::snake(class_basename($notification), ' ')));
         foreach ($message->attachments as $attachment) {
             $m->attach($attachment['file'], $attachment['options']);
         }
         foreach ($message->rawAttachments as $attachment) {
             $m->attachData($attachment['data'], $attachment['name'], $attachment['options']);
         }
     });
 }
 /**
  * Send the given notification.
  *
  * @param  mixed  $notifiable
  * @param  \Illuminate\Notifications\Notification  $notification
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function send($notifiable, Notification $notification)
 {
     if (!($url = $notifiable->routeNotificationFor('slack'))) {
         return;
     }
     $message = $notification->toSlack($notifiable);
     return $this->http->post($url, ['json' => ['text' => $message->content, 'attachments' => $this->attachments($message)]]);
 }
 /**
  * Send the given notification.
  *
  * @param  mixed  $notifiable
  * @param  \Illuminate\Notifications\Notification  $notification
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function send($notifiable, Notification $notification)
 {
     if (!($url = $notifiable->routeNotificationFor('slack'))) {
         return;
     }
     $message = $notification->toSlack($notifiable);
     $this->http->post($url, $this->buildJsonPayload($message));
 }
 /**
  * Get the channels the event should broadcast on.
  *
  * @return array
  */
 public function broadcastOn()
 {
     $channels = $this->notification->broadcastOn();
     if (!empty($channels)) {
         return $channels;
     }
     return [new PrivateChannel($this->channelName())];
 }
Beispiel #5
0
 /**
  * Send the given notification.
  *
  * @param  mixed  $notifiable
  * @param  \Illuminate\Notifications\Notification  $notification
  * @return void
  */
 public function send($notifiable, Notification $notification)
 {
     if (!($to = $notifiable->routeNotificationFor('nexmo'))) {
         return;
     }
     $message = $notification->toNexmo($notifiable);
     if (is_string($message)) {
         $message = new NexmoMessage($message);
     }
     $this->nexmo->message()->send(['from' => $message->from ?: $this->from, 'to' => $to, 'text' => trim($message->content)]);
 }
Beispiel #6
0
 /**
  * Send the given notification.
  *
  * @param  mixed  $notifiable
  * @param  \Illuminate\Notifications\Notification  $notification
  * @return void
  */
 public function send($notifiable, Notification $notification)
 {
     if (!$notifiable->routeNotificationFor('mail')) {
         return;
     }
     $message = $notification->toMail($notifiable);
     $this->mailer->send($message->view, $message->toArray(), function ($m) use($notifiable, $notification, $message) {
         $m->to($notifiable->routeNotificationFor('mail'));
         $m->subject($message->subject ?: Str::title(Str::snake(class_basename($notification), ' ')));
     });
 }
 /**
  * Send the given notification.
  *
  * @param  mixed  $notifiable
  * @param  \Illuminate\Notifications\Notification  $notification
  * @return void
  */
 public function send($notifiable, Notification $notification)
 {
     if (!$notifiable->routeNotificationFor('mail')) {
         return;
     }
     $message = $notification->toMail($notifiable);
     if ($message instanceof Mailable) {
         return $message->send($this->mailer);
     }
     $this->mailer->send($this->buildView($message), $message->data(), function ($mailMessage) use($notifiable, $notification, $message) {
         $this->buildMessage($mailMessage, $notifiable, $notification, $message);
     });
 }