Skip to content

Commit

Permalink
fix(Notifications): Ensure markAllRead api call actually flags all of…
Browse files Browse the repository at this point in the history
… the logged in users notifications as being read.
  • Loading branch information
Patrick Mulligan committed Apr 11, 2024
1 parent 415500c commit 6dc4257
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Modules\Users\Http\Resources\NotificationResourceCollection;
use App\Modules\Users\Http\Resources\NotificationResource;
use App\Modules\Users\Models\User;
use Carbon\Carbon;

/**
* User Notifications
Expand Down Expand Up @@ -302,6 +303,12 @@ public function markAllRead()
->whereNull('read_at')
->get();

foreach($rows as $row)
{
$row->markAsRead();
$row->save();
}

return new NotificationResourceCollection($rows);
}

Expand Down

0 comments on commit 6dc4257

Please sign in to comment.