/** * Handle job * * @param MarkNotificationAsViewed $job * @return void */ public function handle(MarkNotificationAsViewed $job) { $userId = $job->userId; $this->notificationRepository->setNotificationAsViewed($userId); $this->events->fire([new NotificationWasMarkedAsUnviewed($userId)]); }
/** * Handle event * * @param NotificationWasMarkedAsUnviewed $event * @return void */ public function handle(NotificationWasMarkedAsUnviewed $event) { $userId = $event->userId; $total = $this->notificationRepository->countUnviewedByUserId($userId); $this->events->fire([new NotificationUnviewedRecounted($total, $userId)]); }