public function sendNotification(
        SystemNotification $notification,
        DataObject $context,
        $extraData = [],
        $channels = null
    ) {
        // check to make sure that there are users to send it to. If not, we don't bother with it at all
        $recipients = $notification->getRecipients($context);
        if (!count($recipients)) {
            return;
        }

        // if we've got queues and a large number of recipients, lets send via a queued job instead
        if ($this->config()->get('use_queues') && count($recipients) > 5) {
            $extraData['SEND_CHANNELS'] = $channels;
            singleton(QueuedJobService::class)->queueJob(
                new SendNotificationJob(
                    $notification,
                    $context,
                    $extraData
                )
            );
        } else {
            if (!is_array($channels)) {
                $channels = [$channels];
            }
            $channels = count($channels) ? $channels : $this->channels;
            foreach ($channels as $channel) {
                if ($sender = $this->getSender($channel)) {
                    $sender->sendNotification($notification, $context, $extraData);
                }
            }
        }
    }
public function sendNotification(
        SystemNotification $notification,
        DataObject $context,
        $extraData = [],
        $channels = null
    ) {
        // check to make sure that there are users to send it to. If not, we don't bother with it at all
        $recipients = $notification->getRecipients($context);
        if (!count($recipients)) {
            return;
        }

        // if we've got queues and a large number of recipients, lets send via a queued job instead
        if ($this->config()->get('use_queues') && count($recipients) > 5) {
            $extraData['SEND_CHANNELS'] = $channels;
            singleton(QueuedJobService::class)->queueJob(
                new SendNotificationJob(
                    $notification,
                    $context,
                    $extraData
                )
            );
        } else {
            if (!is_array($channels)) {
                $channels = [$channels];
            }
            $channels = count($channels) ? $channels : $this->channels;
            foreach ($channels as $channel) {
                if ($sender = $this->getSender($channel)) {
                    $sender->sendNotification($notification, $context, $extraData);
                }
            }
        }
    }
public function sendNotification ( SystemNotification $ notification , DataObject $ context , $ extraData = [ ] , $ channels = null ) { // check to make sure that there are users to send it to. If not, we don't bother with it at all $ recipients = $ notification -> getRecipients ( $ context ) ; if ( ! count ( $ recipients ) ) { return ; } // if we've got queues and a large number of recipients, lets send via a queued job instead if ( $ this -> config ( ) -> get ( 'use_queues' ) && count ( $ recipients ) > 5 ) { $ extraData [ 'SEND_CHANNELS' ] = $ channels ; singleton ( QueuedJobService :: class ) -> queueJob ( new SendNotificationJob ( $ notification , $ context , $ extraData ) ) ; } else { if ( ! is_array ( $ channels ) ) { $ channels = [ $ channels ] ; } $ channels = count ( $ channels ) ? $ channels : $ this -> channels ; foreach ( $ channels as $ channel ) { if ( $ sender = $ this -> getSender ( $ channel ) ) { $ sender -> sendNotification ( $ notification , $ context , $ extraData ) ; } } } }
Send out a notification
@param SystemNotification $notification The configured notification object
@param DataObject         $context      The context of the notification to send
@param array              $extraData    Any extra data to add into the notification text
@param string             $channels     The specific channels to send through. If not set, just
sends to the default configured
Send out a notification