From eb7382b67260605a4334c978d733a1ebcd86af38 Mon Sep 17 00:00:00 2001 From: Ian Morland <16573496+imorland@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:24:30 +0000 Subject: [PATCH] Only update notifications that are not already marked as read (#3202) --- framework/core/src/Notification/NotificationRepository.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Notification/NotificationRepository.php b/framework/core/src/Notification/NotificationRepository.php index 96030f98a..dcb7acbd8 100644 --- a/framework/core/src/Notification/NotificationRepository.php +++ b/framework/core/src/Notification/NotificationRepository.php @@ -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()]); } }