applySearch($request->all()) ->paginate(10); $newestFlight = Flight::latest() ->take(3) ->get(); $newestTour = Tour::latest() ->take(3) ->get(); $tours = Tour::latest() ->paginate(10); return view('flights.index', compact('flights', 'newestFlight', 'newestTour', 'tours' )); } public function show(Flight $flight) { $flight->increment('views'); $cacheKey = 'flight_views:' . $flight->id . ':' . now()->format('Y-m-d'); Cache::put($cacheKey, Cache::get($cacheKey, 0) + 1, now()->addDays(15)); $comments = $flight->comments() ->latest() ->get(); return view('flights.show', compact('flight', 'comments')); } }