/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $cities = City::select('city_name')->distinct()->get(); $rests = Rest::select('rest_type')->distinct()->get(); $content['cities'] = $cities; $content['rests'] = $rests; return view('index', $content); }
private function getCityName($city_id) { $cityName = City::select('city_name')->where('city_id', '=', $city_id)->first(); return $cityName; }
private function getCityId($city_name) { $cityId = City::select('city_id')->where('city_name', 'LIKE', '%' . $city_name . '%')->first(); if (count($cityId) > 0) { $cityId = $cityId['city_id']; } else { $cityId = null; } return $cityId; }