class NotificationSyncer
The Notification Syncer commits notification blueprints to the database, and sends them via email depending on user preference. Where a blueprint represents a single notification, the syncer associates it with a particular user(s) and makes it available in their inbox.
Properties
static protected bool | $onePerUser | <p>Whether or not notifications are being limited to one per user.</p> | ||
static protected int[] | $sentTo | <p>An internal list of user IDs that notifications have been sent to.</p> | ||
static protected NotificationDriverInterface[] | $notificationDrivers | <p>A map of notification drivers.</p> | ||
static protected array | $beforeSendingCallbacks |
Methods
<p>Sync a notification so that it is visible to the specified users, and not visible to anyone else. If it is being made visible for the first time, attempt to send the user an email.</p>
<p>Limit notifications to one per user for the entire duration of the given callback.</p>
<p>Set the deleted status of a list of notification records.</p>
<p>Check access to determine if the recipient is allowed to receive the notification.</p>
<p>Adds a notification driver to the list.</p>
Details
at
line 60
void
sync(BlueprintInterface $blueprint, array $users)
<p>Sync a notification so that it is visible to the specified users, and not visible to anyone else. If it is being made visible for the first time, attempt to send the user an email.</p>
at
line 127
void
delete(BlueprintInterface $blueprint)
<p>Delete a notification for all users.</p>
at
line 138
void
restore(BlueprintInterface $blueprint)
<p>Restore a notification for all users.</p>
at
line 150
void
onePerUser(callable $callback)
<p>Limit notifications to one per user for the entire duration of the given callback.</p>
at
line 166
protected
setDeleted(array $ids, bool $isDeleted)
<p>Set the deleted status of a list of notification records.</p>
at
line 174
protected bool
userCanSeeSubject(User $user, AbstractModel|null $subject)
<p>Check access to determine if the recipient is allowed to receive the notification.</p>
at
line 191
static void
addNotificationDriver(string $driverName, NotificationDriverInterface $driver)
<p>Adds a notification driver to the list.</p>