Tries to connect and send a notification

@param Notification $notification
@return bool
351277
public function sendNotification(Notification $notification)
    {
        try {
            $connection = $this->getConnection($notification->getType());
            $connection->setNotification($notification);

            $this->logger->info(
                sprintf(
                    "Dispatching notification id: %s",
                    $notification->getIdentifier()
                )
            );

            $this
                ->responseHandler
                ->addIdentifiedResponse(
                    $notification->getIdentifier(),
                    $connection->sendRequest()
                );

            return true;

        } catch (ClientException $e) {
            $this->logger->error(
                sprintf("Client connection error: %s", $e->getMessage())
            );

        } catch (RuntimeException $e) {
            $this->logger->error(
                sprintf("Runtime error: %s", $e->getMessage())
            );

        } catch (\Exception $e) {
            $this->logger->error(
                sprintf("Error occurs: %s", $e->getMessage())
            );
        }

        return false;
    }
1123923
public function send($notifiable, Notification $notification)
    {
        if (! $to = $notifiable->routeNotificationFor('plivo')) {
            return;
        }

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

        if (is_string($message)) {
            $message = new PlivoMessage($message);
        }

        $response = $this->plivo->send_message([
            'src' => $message->from ?: $this->from,
            'dst' => $to,
            'text' => trim($message->content),
        ]);

        if ($response['status'] !== 202) {
            throw CouldNotSendNotification::serviceRespondedWithAnError($response);
        }

        return $response;
    }
615272
public function setRPCNotification($notification)
    {
        empty($notification) ? $this->notification = false : $this->notification = true;
    }
584023
public function sendNotification($notification)
    {
        if (!$notification instanceof DeviceNotification && !$notification instanceof TopicNotification) {
            throw new \InvalidArgumentException('Notification must be of type DeviceNotification or TopicNotification');
        }

        $message = (new Message())
            ->setNotification($notification)
            ->setData($notification->getData())
            ->setPriority($notification->getPriority())
            ->setJsonData($notification->getJsonData())
            ->setContentAvailable($notification->getContentAvailable())
            ->setCollapseKey($notification->getCollapseKey());

        // Check for the type of Notification
        if($notification instanceof DeviceNotification){
            foreach ($notification->getDeviceTokens() as $deviceToken) {
                $message->addRecipient(new Device($deviceToken));
            }
        } else if ($notification instanceof TopicNotification) {
            $message->addRecipient(new Topic($notification->getTopic()));
        }

        return $this->client->send($message);
    }
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);
    }
1270895
public function send($notifiable, Notification $notification)
    {
        $tokens = (array) $notifiable->routeNotificationFor('gcm', $notification);
        if (empty($tokens)) {
            return;
        }

        $message = $notification->toGcm($notifiable);
        if (! $message) {
            return;
        }

        $packet = $this->getPacket($tokens, $message);

        try {
            $response = $this->client->send($packet);
        } catch (Exception $exception) {
            throw SendingFailed::create($exception);
        }

        if (! $response->getFailureCount() == 0) {
            $this->handleFailedNotifications($notifiable, $notification, $response);
        }
    }
1133551
public function send($notifiable, Notification $notification)
    {
        return $notifiable->routeNotificationFor('database', $notification)->create(
            $this->buildPayload($notifiable, $notification)
        );
    }
1243875
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toFacebook($notifiable);

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

        if ($message->toNotGiven()) {
            if (! $to = $notifiable->routeNotificationFor('facebook')) {
                throw CouldNotCreateMessage::recipientNotProvided();
            }

            $message->to($to);
        }

        $this->fb->send($message->toArray());
    }
317704
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toMail($notifiable);

        if (! $notifiable->routeNotificationFor('mail', $notification) &&
            ! $message instanceof Mailable) {
            return;
        }

        if ($message instanceof Mailable) {
            return $message->send($this->mailer);
        }

        $this->mailer->send(
            $this->buildView($message),
            array_merge($message->data(), $this->additionalMessageData($notification)),
            $this->messageBuilder($notifiable, $notification, $message)
        );
    }
726636
public function setNotification($notification)
    {
        if ($notification !== null && !is_callable($notification))
            throw new \InvalidArgumentException('Notification handler must be a callable.');

        $this->notification = $notification;
        return $this;
    }
980047
public function notify(array $devices, array $notification)
    {
        $headers = $this->getNotificationHeaders();
        $body = $this->getNotificationBody($devices, $notification);

        return $this->sendRequest($headers, $body);
    }
966935
public function send($notifiables, $notification)
    {
        return (new NotificationSender(
            $this, $this->app->make(Bus::class), $this->app->make(Dispatcher::class), $this->locale)
        )->send($notifiables, $notification);
    }
1292562
public function send($notifiable, Notification $notification)
    {
        $this->changeTwitterSettingsIfNeeded($notifiable);

        $twitterMessage = $notification->toTwitter($notifiable);
        $twitterMessage = $this->addImagesIfGiven($twitterMessage);

        $this->twitter->post($twitterMessage->getApiEndpoint(), $twitterMessage->getRequestBody($this->twitter),
            $twitterMessage->isJsonRequest);

        if ($this->twitter->getLastHttpCode() !== 200) {
            throw CouldNotSendNotification::serviceRespondsNotSuccessful($this->twitter->getLastBody());
        }
    }
131453
public function setNotification($notification = '')
    {
        if ('' == $notification) {
            $notification = 'General Notification';
        }

        if (!is_string($notification)) {
            throw new BuildException(
                '"notification" attribute is invalid.' .
                ' Expect to be a string, actual is ' . gettype($notification)
            );
        }

        $this->notification = $notification;
    }
204629
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toBearyChat($notifiable);

        if (! $message instanceof Message) {
            throw CouldNotSendNotification::invalidMessage($message);
        }

        if ($route = $notifiable->routeNotificationFor('BearyChat')) {
            if (Str::startsWith($route, ['@', '#'])) {
                $message->to($route);
            } elseif (Str::startsWith($route, ['http://', 'https://'])) {
                if ($client = $message->getClient()) {
                    $client->webhook($route);
                } else {
                    $message->setClient(new Client($route));
                }
            } else {
                $message->setClient($this->clientManager->client($route));
            }
        }

        if (is_null($message->getClient())) {
            $message->setClient($this->clientManager->client());
        }

        if (! $message->send()) {
            throw CouldNotSendNotification::sendingFailed($message->getClient()->getWebhook(), $message);
        }
    }
1274147
public function send($notifiable, Notification $notification)
    {
        if (! $userIds = $notifiable->routeNotificationFor('OneSignal', $notification)) {
            return;
        }

        /** @var ResponseInterface $response */
        $response = $this->oneSignal->sendNotificationCustom(
            $this->payload($notifiable, $notification, $userIds)
        );

        if ($response->getStatusCode() !== 200) {
            throw CouldNotSendNotification::serviceRespondedWithAnError($response);
        }

        return $response;
    }
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;
    }