public function all() { $this->locale = in_array(Request::header('Locale'), $this->avaibleLocales) ? Request::header('Locale') : $this->avaibleLocales[0]; $date = Input::has('date') ? Input::get('date') : null; if (is_null($date)) { $cities = CityRef::all(); $vehicles = VehicleTypeRef::all(); $bodyTypes = BodyTypeRef::all(); $marks = MarkRef::all(); $models = ModelRef::all(); } else { $cities = CityRef::where('updated_at', '>=', $date)->get(); $vehicles = VehicleTypeRef::where('updated_at', '>=', $date)->get(); $marks = MarkRef::where('updated_at', '>=', $date)->get(); $bodyTypes = BodyTypeRef::where('updated_at', '>=', $date)->get(); $models = ModelRef::where('updated_at', '>=', $date)->get(); } $response['vehicle-types'] = $this->transformVehicles($vehicles); $response['body-types'] = $this->transformBodyTypes($bodyTypes); $response['cities'] = $this->transformCities($cities); $response['models'] = $models; $response['marks'] = $marks; $response['date'] = Carbon::now()->toDateTimeString(); return $this->respond($response); }