/** * show one hotel, based on a city * @param $id * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function showHotel($id) { $hotel_id = City::getCityFromAutoComplete($id); $hotels = AgodaHotel::where('hotel_id', $hotel_id)->paginate(); $hotel_list = AgodaHotel::where('hotel_id', $id)->get(['hotel_name', 'url', 'city']); $city = $hotel_list->first()->city; $price_range = [0, 10000]; //todo: make a proper one hotel page return view('agoda.show_city', compact('city', 'price_range', 'hotels', 'hotel_list')); }
/** * Return the favorites of a certain model or table, leave the data as is under $model->settings['favorites'] * * @param $model * @param $data * * @return object|false */ static function getFavoritesByModel($model, $data) { if (!isset($data[$model])) { return false; } $data = array_keys($data[$model]); switch ($model) { case 'articles': return Article::whereIn('id', $data)->get(); case 'sites': return Site::whereIn('id', $data)->get(); case 'professions': return Profession::whereIn('id', $data)->get(); case 'classifieds': return Classified::whereIn('id', $data)->get(); case 'albums': return Album::whereIn('id', $data)->get(); case 'agoda': return AgodaHotel::whereIn('hotel_id', $data)->get(); default: return false; } }