From d8c2cbc26532277ac8a5000c41638b8cf5626eaf Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 15 Sep 2015 16:20:22 +0930 Subject: [PATCH] Mark all notifications with the same subject as read --- .../Notifications/Commands/ReadNotificationHandler.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Core/Notifications/Commands/ReadNotificationHandler.php b/src/Core/Notifications/Commands/ReadNotificationHandler.php index 74038e030..1a84131aa 100644 --- a/src/Core/Notifications/Commands/ReadNotificationHandler.php +++ b/src/Core/Notifications/Commands/ReadNotificationHandler.php @@ -31,8 +31,12 @@ class ReadNotificationHandler $notification = Notification::where('user_id', $actor->id)->findOrFail($command->notificationId); - $notification->read(); - $notification->save(); + Notification::where([ + 'user_id' => $actor->id, + 'type' => $notification->type, + 'subject_id' => $notification->subject_id + ]) + ->update(['is_read' => true]); return $notification; }