/** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function index(Request $request) { // show the user home page $user = Auth::user(); // authenticated user $tags = Note::existingTags()->sortBy('slug'); $filter = $request->f; if ($filter !== null) { $notes = $user->notes()->withAnyTag($filter)->latest('updated_at')->paginate(5); } else { $notes = $user->notes()->latest('updated_at')->paginate(5); } return view('home', compact('user', 'notes', 'tags', 'filter')); }