Only update notifications that are not already marked as read (#3202)

This commit is contained in:
Ian Morland 2021-12-14 18:24:30 +00:00 committed by GitHub
parent 10c6694087
commit 25dc26bac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,8 @@ class NotificationRepository
*/
public function markAllAsRead(User $user)
{
Notification::where('user_id', $user->id)->update(['read_at' => Carbon::now()]);
Notification::where('user_id', $user->id)
->whereNull('read_at')
->update(['read_at' => Carbon::now()]);
}
}