Get the data for the notification.

@param  mixed  $notifiable
@param  \Illuminate\Notifications\Notification  $notification
@return mixed

@throws \RuntimeException
501938
protected function getData($notifiable, Notification $notification)
    {
        if (method_exists($notification, 'toBroadcast')) {
            return $notification->toBroadcast($notifiable);
        }

        if (method_exists($notification, 'toArray')) {
            return $notification->toArray($notifiable);
        }

        throw new RuntimeException('Notification is missing toArray method.');
    }
1254797
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toTelegram($notifiable);

        if (is_string($message)) {
            $message = TelegramMessage::create($message);
        }

        if ($message->toNotGiven()) {
            if (!$to = $notifiable->routeNotificationFor('telegram')) {
                throw CouldNotSendNotification::chatIdNotProvided();
            }

            $message->to($to);
        }

        if(isset($message->payload['text']) && $message->payload['text'])
        {
            $params = $message->toArray();
            $this->telegram->sendMessage($params);
        }
        elseif (isset($message->payload['latitude']) && isset($message->payload['longitude'])) {
            $params = $message->toArray();
            $this->telegram->sendLocation($params);
        }
        else
        {
            if(isset($message->payload['file']))
            {
                $params = $message->toMultipart();
                $this->telegram->sendFile($params, $message->type, true);
            }
            else
            {
                $params = $message->toArray();
                $this->telegram->sendFile($params, $message->type);
            }
        }
    }
1133551
public function send($notifiable, Notification $notification)
    {
        return $notifiable->routeNotificationFor('database', $notification)->create(
            $this->buildPayload($notifiable, $notification)
        );
    }
1150923
public function sendNow($notifiables, $notification)
    {
        if (! $notifiables instanceof Collection && ! is_array($notifiables)) {
            $notifiables = [$notifiables];
        }

        $original = clone $notification;

        foreach ($notifiables as $notifiable) {
            $notification = clone $original;

            $notification->id = (string) Uuid::uuid4();

            $channels = $notification->via($notifiable);

            if (empty($channels)) {
                continue;
            }

            foreach ($channels as $channel) {
                if (! $this->shouldSendNotification($notifiable, $notification, $channel)) {
                    continue;
                }

                $response = $this->driver($channel)->send($notifiable, $notification);

                $this->app->make('events')->fire(
                    new Events\NotificationSent($notifiable, $notification, $channel, $response)
                );
            }
        }
    }
987185
public function send($notifiable, Notification $notification)
    {
        if (! $pushoverReceiver = $notifiable->routeNotificationFor('pushover')) {
            return;
        }

        if (is_string($pushoverReceiver)) {
            $pushoverReceiver = PushoverReceiver::withUserKey($pushoverReceiver);
        }

        $message = $notification->toPushover($notifiable);

        try {
            $this->pushover->send(array_merge($message->toArray(), $pushoverReceiver->toArray()));
        } catch (ServiceCommunicationError $serviceCommunicationError) {
            $this->fireFailedEvent($notifiable, $notification, $serviceCommunicationError->getMessage());
        }
    }
802010
public function toMail($notifiable)
    {
        $content = 'A route on ' . url('/') . ' was requested.';
        if($notifiable->filter !== '*' && !is_numeric($notifiable->filter)) {
            $content .= " You're being notified because the route contains `" . $notifiable->filter . "`";
        }

        if(is_numeric($notifiable->filter)) {
            $content .= " You're being notified because the execution time exceeded your limit of " . $notifiable->filter . "ms.";
        }

        $alertColor = '#00B945';
        if(is_numeric($notifiable->filter) && $this->requestInfo['execution_time'] > intval($notifiable->filter)) {
            $alertColor = '#BC001A';
        }

        return (new MailMessage)
            ->subject(env('LARAMETRICS_ROUTE_SUBJECT', '[Larametrics Alert] A route has been requested'))
            ->from(env('LARAMETRICS_FROM_EMAIL', 'alerts@larametrics.com'), env('LARAMETRICS_FROM_NAME', 'Larametrics Alerts'))
            ->view('larametrics::emails.route-requested', [
                'requestInfo' => $this->requestInfo,
                'content' => $content,
                'alertColor' => $alertColor
            ]);
    }
934531
public function renderNotifications(NotifiableInterface $notifiable, array $options)
    {
        $order = array_key_exists('order', $options) ? $options['order'] : null;
        $limit = array_key_exists('limit', $options) ? $options['limit'] : null;
        $offset = array_key_exists('offset', $options) ? $options['offset'] : null;

        if ($options['seen']) {
            $notifications = $this->notificationManager->getNotifications($notifiable, $order, $limit, $offset);
        } else {
            $notifications = $this->notificationManager->getUnseenNotifications($notifiable, $order, $limit, $offset);
        }

        // if the template option is set, use custom template
        $template = array_key_exists('template', $options) ? $options['template'] : '@MgiletNotification/notification_list.html.twig';

        return $this->twig->render($template,
            array(
                'notificationList' => $notifications
            )
        );
    }
308962
public function toMail($notifiable)
    {
        return (new MailMessage)
            ->view('HCACL::emails.template')
            ->subject(trans('HCACL::users.activation.mail.subject'))
            ->line(trans('HCACL::users.activation.mail.text', ['email' => $notifiable->email]))
            ->action(trans('HCACL::users.activation.activate'), route('auth.activation', $this->token));
    }
648299
protected function sendToNotifiable($notifiable, $id, $notification, $channel)
    {
        if (! $notification->id) {
            $notification->id = $id;
        }

        if (! $this->shouldSendNotification($notifiable, $notification, $channel)) {
            return;
        }

        $response = $this->manager->driver($channel)->send($notifiable, $notification);

        $this->events->dispatch(
            new Events\NotificationSent($notifiable, $notification, $channel, $response)
        );
    }
382932
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toSlack();

        $this->http->post($notifiable, $this->buildJsonPayload($message));
    }
1338779
public function toMail($notifiable)
    {
        return (new MailMessage())
                    ->subject($this->subject)
                    ->greeting(__('laralum_notifications::general.new_notification'))
                    ->line(__('laralum_notifications::general.new_message'))
                    ->action(__('laralum_notifications::general.view_notification'), route('laralum::notifications.index'));
    }
736137
protected function shouldSendNotification($notifiable, $notification, $channel)
    {
        $event = new SendEvent([
            'notification' => $notification,
            'notifiable' => $notifiable,
            'channel' => $channel,
        ]);

        $this->trigger(self::EVENT_BEFORE_SEND, $event);

        return $event->sendNotification;
    }
732112
public function toMail($notifiable)
    {
        return (new MailMessage)
            ->error()
            ->subject(config('app.name').': Long Queue Wait Detected')
            ->greeting('Oh no! Something needs your attention.')
            ->line(sprintf(
                 'The "%s" queue on the "%s" connection has a wait time of %s seconds.',
                $this->longWaitQueue, $this->longWaitConnection, $this->seconds
            ));
    }
1340268
public function send($notifiable, Notification $notification)
    {
        if (! $notifiable->routeNotificationFor('mail')) {
            return;
        }

        $message = $notification->toMail($notifiable);

        $this->mailer->send($message->view, $message->data(), function ($m) use ($notifiable, $notification, $message) {
            $recipients = $notifiable->routeNotificationFor('mail');

            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']);
            }
        });
    }
1178725
public function send($notifiable, Notification $notification)
    {
        if (! $url = $notifiable->routeNotificationFor('Webhook')) {
            return;
        }

        $webhookData = $notification->toWebhook($notifiable)->toArray();

        $response = $this->client->post($url, [
            'body' => json_encode(Arr::get($webhookData, 'data')),
            'verify' => false,
            'headers' => Arr::get($webhookData, 'headers'),
        ]);

        if ($response->getStatusCode() >= 300 || $response->getStatusCode() < 200) {
            throw CouldNotSendNotification::serviceRespondedWithAnError($response);
        }
    }
21191
public function send($notifiable, Notification $notification)
    {
        $email = $notification->toMailDb($notifiable);
        $email->save();
        if ($email->id > 0) {
            return 1;
        }
        return 0;
    }
1022902
public function toMail($notifiable)
    {
        $content = 'A log on ' . url('/') . ' has been written to.';
        if($notifiable->filter !== '*') {
            $content .= " You're being notified because the log contains `" . $notifiable->filter . "`";
        }

        $status = 'success';
        foreach($this->notificationLevels as $triggerLevel => $childLevels) {
            if(in_array($this->requestInfo['level'], $childLevels)) {
                $status = $triggerLevel;
            }
        }

        $fields = array(
            'Level' => $this->requestInfo['level'],
            'Message' => $this->requestInfo['message']
        );

        if($this->requestInfo['user_id']) {
            $fields['User ID'] = $this->requestInfo['user_id'];
        }

        if($this->requestInfo['email']) {
            $fields['Associated Email'] = $this->requestInfo['email'];
        }

        $statusColors = array(
            'success' => '#00B945',
            'warning' => '#ff9f00',
            'error' => '#BC001A'
        );

        return (new MailMessage)
            ->subject(env('LARAMETRICS_LOG_SUBJECT', '[Larametrics Alert] The application log has been written to'))
            ->from(env('LARAMETRICS_FROM_EMAIL', 'alerts@larametrics.com'), env('LARAMETRICS_FROM_NAME', 'Larametrics Alerts'))
            ->view('larametrics::emails.log-written', [
                'requestInfo' => $this->requestInfo,
                'content' => $content,
                'alertColor' => $statusColors[$status]
            ]);
    }