/** * Mark all notifications as read * * @param UserInterface $user * @return bool */ public function markAllRead(UserInterface $user) { $this->eventService->fire('user.notifications.markAllRead.pre', ['user' => $user]); $result = $this->notificationMapper->markAllRead($user->getId()); $this->eventService->fire('user.notifications.markAllRead.post', ['user' => $user]); return $result; }
/** * Find unread notifications * * @param UserInterface $user * @return array|\LaravelUserNotifications\Models\NotificationInterface[] */ public function findUnreadByUser($user) { return $this->notificationMapper->findUnreadByUser($user->getId()); }