mark all notification as read

This commit is contained in:
aynsix
2022-02-10 17:23:01 +03:00
parent 974fbf9164
commit 10ef15964f
13 changed files with 104 additions and 6 deletions

View File

@@ -159,6 +159,27 @@ class UserNotificationController extends Controller
}
}
/**
* mark all notification as read
*
* @param Request $request
* @return JsonResponse
*/
public function readAllNotification(Request $request)
{
if (!$request->isXmlHttpRequest()) {
$this->app->abort(400);
}
try {
$this->getEventsManager()->readAll($this->getAuthenticatedUser()->getId());
return $this->app->json(['success' => true, 'message' => '']);
}
catch (\Exception $e) {
return $this->app->json(['success' => false, 'message' => $e->getMessage()]);
}
}
/**
* Get all notifications