Database notification storage — persist, query, and manage notification read state in the database.
composer require marko/notification-databaseuse Marko\Notification\Database\Repository\NotificationRepositoryInterface;
public function __construct(
private NotificationRepositoryInterface $notificationRepository,
) {}
// Fetch all notifications for a user
$notifications = $this->notificationRepository->forNotifiable($user);
// Count unread
$count = $this->notificationRepository->unreadCount($user);
// Mark all as read
$this->notificationRepository->markAllAsRead($user);Full usage, API reference, and examples: marko/notification-database