Flarum\Core\Notification\NotificationSyncer::sendNotifications PHP Method

sendNotifications() protected method

Create a notification record and send an email (depending on user preference) from a blueprint to a list of recipients.
protected sendNotifications ( Flarum\Core\Notification\BlueprintInterface $blueprint, array $recipients )
$blueprint Flarum\Core\Notification\BlueprintInterface
$recipients array
    protected function sendNotifications(BlueprintInterface $blueprint, array $recipients)
    {
        $now = Carbon::now('utc')->toDateTimeString();
        event(new NotificationWillBeSent($blueprint, $recipients));
        $attributes = $this->getAttributes($blueprint);
        Notification::insert(array_map(function (User $user) use($attributes, $now) {
            return $attributes + ['user_id' => $user->id, 'time' => $now];
        }, $recipients));
        if ($blueprint instanceof MailableInterface) {
            $this->mailNotifications($blueprint, $recipients);
        }
    }