_notificationFactory = $notificationFactory; } /** * Mark notification as read * * @param int $notificationId * @return void * @throws \Magento\Framework\Exception\LocalizedException */ public function markAsRead($notificationId) { $notification = $this->_notificationFactory->create(); $notification->load($notificationId); if (!$notification->getId()) { throw new \Magento\Framework\Exception\LocalizedException(__('Wrong notification ID specified.')); } $notification->setIsRead(1); $notification->save(); } }