Send the given notification.

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

@return void
174142
public function send($notifiable, Notification $notification)
    {
        $interest = $notifiable->routeNotificationFor('PusherPushNotifications')
            ?: $this->interestName($notifiable);

        $response = $this->pusher->notify(
            $interest,
            $notification->toPushNotification($notifiable)->toArray(),
            true
        );

        if (! in_array($response['status'], [200, 202])) {
            $this->events->fire(
                new NotificationFailed($notifiable, $notification, 'pusher-push-notifications', $response)
            );
        }
    }
139315
public static function make($notifiable, Notification $notification, $targeting): array
    {
        $payload = $notification->toOneSignal($notifiable)->toArray();

        if (static::isTargetingEmail($targeting)) {
            $payload['filters'] = collect([['field' => 'email', 'value' => $targeting['email']]]);
        } elseif (static::isTargetingTags($targeting)) {
            $array = $targeting['tags'];
            $res = count($array) == count($array, COUNT_RECURSIVE);
            if ($res) {
                $payload['tags'] = collect([$targeting['tags']]);
            } else {
                $payload['tags'] = collect($targeting['tags']);
            }
        } elseif (static::isTargetingIncludedSegments($targeting)) {
            $payload['included_segments'] = collect($targeting['included_segments']);
        } elseif (static::isTargetingExcludedSegments($targeting)) {
            $payload['excluded_segments'] = collect($targeting['excluded_segments']);
        } elseif (static::isTargetingExternalUserIds($targeting)) {
            $payload['include_external_user_ids'] = collect($targeting['include_external_user_ids']);
        } else {
            $payload['include_player_ids'] = collect($targeting);
        }

        return $payload;
    }
672291
public function markAsSeen(NotifiableInterface $notifiable, NotificationInterface $notification, $flush = false)
    {
        $nn = $this->getNotifiableNotification($notifiable, $notification);
        if ($nn) {
            $nn->setSeen(true);
            $event = new NotificationEvent($notification, $notifiable);
            $this->dispatcher->dispatch(MgiletNotificationEvents::SEEN, $event);
            $this->flush($flush);
        } else {
            throw new EntityNotFoundException('The link between the notifiable and the notification has not been found');
        }
    }
42333
public function send($notifiable, Notification $notification)
    {
        if (!$to = $notifiable->routeNotificationFor('SMS')) {
            return;
        }

        $message = $notification->toSMS($notifiable);
        if (is_string($message)) {
            $message = new SMSMessage($message);
        }

        $this->SMSManager
            ->channel($message->channel)
            ->send($to, $message->content);
    }
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]
            ]);
    }
1029038
public function toMail($notifiable)
    {
        $mail = (new MailMessage)
                    ->line($this->intro)
                    ->subject($this->subject);

        if ($this->confirmation) {
            $mail->replyTo($this->replyTo[0], $this->replyTo[1]);
        }

        $mail->viewData = [
                'rawText' => $this->createSubmissionEmail($this->submission),
                'rawTextPlain' => $this->createSubmissionEmailPlain($this->submission)
            ];

        return $mail;
    }
69611
public function send($notifiables, $notification)
    {
        if (! $notifiables instanceof Collection && ! is_array($notifiables)) {
            $notifiables = [$notifiables];
        }

        if ($notification instanceof ShouldQueue) {
            return $this->queueNotification($notifiables, $notification);
        }

        return $this->sendNow($notifiables, $notification);
    }
564675
public function send($notifiable, Notification $notification)
    {
        if (! $to = $notifiable->routeNotificationFor($this->notificationFor())) {
            return;
        }

        $message = $this->buildMessage($notifiable, $notification);

        $data = $this->buildData($message);

        $this->push($this->pushServiceName(), $to, $data, $message);
    }
829089
public function send($notifiable, Notification $notification)
    {
        $message = collect($notification->toSms($notifiable));
        $sms = new EasySms(config('easysms'));
        if (! ($message->has('content') && $message->has('template') && $message->has('data') && $message->has('phone'))) {
            throw new GeneralException('短信消息实体必须带有 `content`, `template`, `data`, `phone` 字段。');
        }

        try {
            $response = $sms->send($message['phone'], $message->except('phone')->all());
        } catch (NoGatewayAvailableException $e) {
            Log::error('短信发送失败');
        }


    }
39595
public function toMail($notifiable)
    {
        return (new MailMessage)
            ->line('Hey '.$notifiable->name)
            ->line('We have a notfiication for you.')
            ->line($this->info['title'])
            ->line($this->info['details'])
            ->action('Visit here for more info', url('/user/notifications'));
    }
1256990
protected function handleFailedNotifications($notifiable, Notification $notification, $response)
    {
        $results = $response->getResults();

        foreach ($results as $token => $result) {
            if (! isset($result['error'])) {
                continue;
            }

            $this->events->dispatch(
                new NotificationFailed($notifiable, $notification, get_class($this), [
                    'token' => $token,
                    'error' => $result['error'],
                ])
            );
        }
    }
1041084
public function send($notifiables, $notification)
    {
        $notifiables = $this->formatNotifiables($notifiables);

        if (! $notification instanceof ShouldQueueInterface) {
            return $this->sendNow($notifiables, $notification);
        }

        foreach ($notifiables as $notifiable) {
            $notificationId = Uuid::uuid4()->toString();

            foreach ($notification->via($notifiable) as $channel) {
                $this->queueToNotifiable($notifiable, $notificationId, clone $notification, $channel);
            }
        }
    }
920487
public function addNotifiableNotification(NotifiableNotification $notifiableNotification)
    {
        if (!$this->notifiableNotifications->contains($notifiableNotification)) {
            $this->notifiableNotifications[] = $notifiableNotification;
            $notifiableNotification->setNotifiableEntity($this);
        }

        return $this;
    }
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']);
            }
        });
    }
955816
public function toMail($notifiable)
    {
        $content = trans('notifications.component.status_update.mail.content', [
            'name'       => $this->component->name,
            'old_status' => $this->component->human_status,
            'new_status' => trans("cachet.components.status.{$this->status}"),
        ]);

        return (new MailMessage())
            ->subject(trans('notifications.component.status_update.mail.subject'))
            ->markdown('notifications.component.update', [
                'componentName'          => $this->component->name,
                'content'                => $content,
                'unsubscribeText'        => trans('cachet.subscriber.unsubscribe'),
                'unsubscribeUrl'         => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
                'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
                'manageSubscriptionUrl'  => cachet_route('subscribe.manage', $notifiable->verify_code),
        ]);
    }
616627
public function markAsUnseen(NotifiableInterface $notifiable, NotificationInterface $notification, $flush = false)
    {
        $nn = $this->getNotifiableNotification($notifiable, $notification);
        if ($nn) {
            $nn->setSeen(false);
            $event = new NotificationEvent($notification, $notifiable);
            $this->dispatcher->dispatch(MgiletNotificationEvents::UNSEEN, $event);
            $this->flush($flush);
        } else {
            throw new EntityNotFoundException('The link between the notifiable and the notification has not been found');
        }
    }
531461
public function push($notification, $notifiable)
    {
        if ( ! is_array($notifiable) && ! $notifiable instanceof Traversable) {
            $notifiable = [$notifiable];
        }

        foreach ($notifiable as $toBeNotified) {
            if ( ! $toBeNotified instanceof Notifiable && !$toBeNotified instanceof NotifiableGroup) {
                throw new NotNotifiableException("The notifiable members must implement the notifiable interface.");
            }
        }

        $notification = is_string($notification) ? ['body' => $notification] : $notification;

        foreach ($notifiable as $toBeNotified) {
            $this->pushNotification($notification, $toBeNotified);
        }
    }