has('category') && $request->category != '') { $query->where('category', $request->category); } $informations = $query->orderBy('created_at', 'desc') ->paginate(6) ->withQueryString(); $categories = Information::where('is_published', true) ->distinct() ->pluck('category'); return view('informations.index', compact('informations', 'categories')); } public function show($id) { $information = Information::where('is_published', true)->findOrFail($id); return view('informations.show', compact('information')); } }