notifications()->paginate(); return view('notifications.index')->with([ 'notifications' => $notifications, ]); } /** Display the specified resource. */ public function show(string $id) { $notification = Auth::user()->notifications()->findOrFail($id); $notification->markAsRead(); return view('notifications.show')->with([ 'notification' => $notification, ]); } public function readAll() { $notifications = Auth::user()->notifications()->get(); foreach ($notifications as $notification) { $notification->markAsRead(); } return redirect()->back(); } }