๐ Notifications
Channel: database โ stored in notifications table
Send Notification
Notifying: Demo User
// Notification class
public function via($notifiable): array
{ return ['database']; }
public function toDatabase($n): array
{ return ['post_id' => ..., 'msg' => ...]; }
// Send
$user->notify(new PostPublishedNotification($p));
Notification::send($users, new ...);
// Read
$user->notifications; // all
$user->unreadNotifications;
$user->unreadNotifications()->update(['read_at'=>now()]);
Notifications (1 total,
1 unread)
A post was published: test
1 month ago ยท unread