From 66d83c0ce6dd7a0807866dee28209f3fabfc2323 Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Thu, 18 Nov 2021 23:05:04 +0300 Subject: [PATCH] Add flight_time to searchable fields (#1356) --- app/Repositories/FlightRepository.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Repositories/FlightRepository.php b/app/Repositories/FlightRepository.php index 4faa4ad5..99136a7a 100644 --- a/app/Repositories/FlightRepository.php +++ b/app/Repositories/FlightRepository.php @@ -21,6 +21,7 @@ class FlightRepository extends Repository implements CacheableInterface 'callsign', 'distance', 'dpt_airport_id', + 'flight_time', 'flight_type', 'flight_number' => 'like', 'route_code' => 'like', @@ -133,6 +134,16 @@ class FlightRepository extends Repository implements CacheableInterface $where[] = ['distance', '<=', $request->input('dlt')]; } + // Time, greater than + if ($request->filled('tgt')) { + $where[] = ['flight_time', '>=', $request->input('tgt')]; + } + + // Time, less than + if ($request->filled('tlt')) { + $where[] = ['flight_time', '<=', $request->input('tlt')]; + } + // Do a special query for finding the child subfleets if ($request->filled('subfleet_id')) { $relations['subfleets'] = [