/** * 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 getRestId($rest) { $restIdDb = Rest::select('rest_id')->where('rest_type', 'LIKE', '%' . $rest . '%')->get(); $restId = array(); if (count($restIdDb) > 0) { for ($i = 0; $i < count($restIdDb); $i++) { $restId[$i] = $restIdDb[$i]['rest_id']; } return $restId; } else { return $restId = null; } }