コード例 #1
0
ファイル: PostController.php プロジェクト: sinka49/republic
 /**
  * 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);
 }
コード例 #2
0
ファイル: PlaceController.php プロジェクト: sinka49/republic
 private function getCityName($city_id)
 {
     $cityName = City::select('city_name')->where('city_id', '=', $city_id)->first();
     return $cityName;
 }
コード例 #3
0
 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;
 }