user() ->notifications() ->limit(20) ->get(); auth()->user()->notifications()->whereNull('read_at')->update(['read_at' => now()]); return view('notifications.index', compact('notifications')); } public function markRead(Notification $notification) { abort_if($notification->user_id !== auth()->id(), 403); $notification->update(['read_at' => now()]); return response()->json(['ok' => true]); } }