Mark as read a specific notification in Laravel 5.3 Notifications Mark as read a specific notification in Laravel 5.3 Notifications laravel laravel

Mark as read a specific notification in Laravel 5.3 Notifications


According to this Answer on Github, solution is :

Illuminate\Notifications\DatabaseNotification is where the Model for the notifications exists, you can use it to grab a notification by ID and delete it. Also if you don't want to use the model you can use a normal DB query.


This works without fail:

$id = auth()->user()->unreadNotifications[0]->id;auth()->user()->unreadNotifications->where('id', $id)->markAsRead();


$notification = auth()->user()->notifications()->find($notificationid);if($notification) {    $notification->markAsRead();}