DatabaseChannel
final class DatabaseChannel implements Channel
Database-backed notification channel.
Persists a notification record to the notifications table using the
{\Core\Models\Notifications} model. The payload is expected to be the
result of the notification's {\Core\Lib\Notifications\Notification::toDatabase()}
and is JSON-encoded for storage.
Example usage (via Notifiable trait): $user->notify(new \App\Notifications\UserRegistered($user));
Methods
static string
name()
Short channel name used in Notification::via().
void
send(object $notifiable, Notification $notification, mixed $payload)
Persist the notification for the given notifiable entity.
Details
at line 35
static string
name()
Short channel name used in Notification::via().
at line 62
void
send(object $notifiable, Notification $notification, mixed $payload)
Persist the notification for the given notifiable entity.
Accepts mixed per the Channel interface, but expects:
- $notifiable: an object (typically using the Notifiable trait) exposing a public
id(int|string). - $notification: an instance of \Core\Lib\Notifications\Notification.
- $payload: array data produced by toDatabase(), or null.