public function OpignoNotificationController::markRead in Opigno notifications 8
Ajax callback. Marks the notification as read.
1 string reference to 'OpignoNotificationController::markRead'
File
- src/
Controller/ OpignoNotificationController.php, line 34
Class
- OpignoNotificationController
- Provides the controller for OpignoNotification entity pages.
Namespace
Drupal\opigno_notification\ControllerCode
public function markRead(OpignoNotificationInterface $opigno_notification = NULL) {
if ($opigno_notification === NULL) {
throw new NotFoundHttpException();
}
$uid = \Drupal::currentUser()
->id();
if ($opigno_notification
->getUser() !== $uid) {
throw new AccessDeniedHttpException();
}
$opigno_notification
->setHasRead(TRUE);
$opigno_notification
->save();
return new JsonResponse([]);
}