Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NotificationService.php
Go to the documentation of this file.
1 <?php
7 
16 {
21 
25  public function __construct(\Magento\AdminNotification\Model\InboxFactory $notificationFactory)
26  {
27  $this->_notificationFactory = $notificationFactory;
28  }
29 
37  public function markAsRead($notificationId)
38  {
39  $notification = $this->_notificationFactory->create();
40  $notification->load($notificationId);
41  if (!$notification->getId()) {
42  throw new \Magento\Framework\Exception\LocalizedException(__('Wrong notification ID specified.'));
43  }
44  $notification->setIsRead(1);
45  $notification->save();
46  }
47 }
__()
Definition: __.php:13
__construct(\Magento\AdminNotification\Model\InboxFactory $notificationFactory)