flightRepo = $flightRepo; } public function get($id) { $flight = $this->flightRepo->find($id); FlightResource::withoutWrapping(); return new FlightResource($flight); } public function search(Request $request) { try { $flights = $this->flightRepo->searchCriteria($request)->paginate(); } catch (RepositoryException $e) { return response($e, 503); } return FlightResource::collection($flights); } }