/** * @param NotificationInterface $notification * @return CallInterface */ public function sendNotification(NotificationInterface $notification) { $senders = $this->getSenders(); if (!$senders->hasSender($notification->getType())) { throw new Exception\RuntimeException(sprintf('No sender registered for notification type "%s"', $notification->getType())); } $sender = $senders->getSender($notification->getType()); $call = $sender->send($notification->getPayload(), $notification->getParams()); return $call; }
/** * This example assumes there is a style tag in the view. * * @param NotificationInterface $notification */ public function sendNotification(NotificationInterface $notification) { $this->mailer->send('emails.notification', compact('notification'), function ($message) use($notification) { $message->to($notification->getUser()->email); }); }