当前位置: 首页>>代码示例>>PHP>>正文


PHP City::where方法代码示例

本文整理汇总了PHP中app\models\City::where方法的典型用法代码示例。如果您正苦于以下问题:PHP City::where方法的具体用法?PHP City::where怎么用?PHP City::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\City的用法示例。


在下文中一共展示了City::where方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCity

 public function getCity(Request $req)
 {
     $state = State::find($req->id);
     $city = City::where('state_code', $state->code)->get();
     $html = '<option value="" selected>Choose Option</option>';
     foreach ($city as $cities) {
         $html .= '<option value="' . $cities->id . '">' . $cities->name . '</option>';
     }
     echo $html;
 }
开发者ID:khakanali,项目名称:OpenMAll,代码行数:10,代码来源:AjaxController.php

示例2: cityAutocompleteAction

 public function cityAutocompleteAction()
 {
     $c = $this->query->get('c');
     $cities = City::where('active', '=', 1)->where('name', '=', $c);
     //
     //        $cities = $this->em->getRepository('PoiskRabotyMainBundle:City')->get(array(
     //            'enabled' => true,
     //            'search_start' => $c,
     //        ));
     $json = array();
     foreach ($cities as $city) {
         $json[] = array('value' => $this->helper->getTranslation($city, 'title'), 'label' => $this->helper->getTranslation($city, 'title'));
     }
     return new JsonResponse($json);
 }
开发者ID:sashacitylight,项目名称:sashasite,代码行数:15,代码来源:HomeController.php

示例3: getCity

 public function getCity($country = null)
 {
     try {
         $response = [];
         $statusCode = 200;
         //$city = City::all();
         $city = City::where('city_accent', 'like', '%' . $country . '%')->take(10)->get();
         foreach ($city as $c) {
             $response[] = ['id' => $c->id, 'city_accent' => $c->city_accent . ' (' . $c->country_id . ')'];
         }
     } catch (Exception $e) {
         $statusCode = 404;
     } finally {
         return Response::json($response, $statusCode);
     }
 }
开发者ID:armannadim,项目名称:banglafest,代码行数:16,代码来源:BackendController.php

示例4: locations

 public function locations($state_id, $city_key)
 {
     $city = City::where("estado_id", $state_id)->where("clave", $city_key)->first();
     $locations = Location::where("municipio_id", $city->id)->get();
     return response()->json($locations)->header('Access-Control-Allow-Origin', '*');
 }
开发者ID:GobiernoFacil,项目名称:tu-evaluas,代码行数:6,代码来源:Applicants.php

示例5: result

 function result($id)
 {
     $blueprint = Blueprint::with(["questions.options"])->find($id);
     $test = function ($question_type, $inegi_key) {
         if (!$inegi_key) {
             return "-";
         }
         switch ($question_type) {
             case "location-a":
                 $key = substr($inegi_key->text_value, 0, 2);
                 $name = !empty($key) ? $this->states[$key] : "-";
                 break;
             case "location-b":
                 $state_key = substr($inegi_key->text_value, 0, 2);
                 $state_name = !empty($state_key) ? $this->states[$state_key] : "-";
                 $city_key = substr($inegi_key->text_value, 2, 3);
                 $city = !empty($city_key) ? City::where("clave", $city_key)->where("estado_id", (int) $state_key)->first() : null;
                 $city_name = $city ? $city->nombre : "-";
                 $name = $city_name . ", " . $state_name;
                 break;
             case "location-c":
                 $state_key = substr($inegi_key->text_value, 0, 2);
                 $state_name = !empty((int) $state_key) ? $this->states[$state_key] : "-";
                 $city_key = substr($inegi_key->text_value, 2, 3);
                 $city = !empty($city_key) ? City::where("clave", $city_key)->where("estado_id", (int) $state_key)->first() : null;
                 $city_name = $city ? $city->nombre : "-";
                 $location_key = substr($inegi_key->text_value, 5, 4);
                 $location = !empty((int) $location_key) ? Location::where("clave", $location_key)->where("municipio_id", $city->id)->first() : null;
                 $location_name = $location ? $location->nombre : "-";
                 $name = $location_name . ", " . $city_name . ", " . $state_name;
                 break;
             default:
                 $name = "-";
                 break;
         }
         return $name;
     };
     if (!$blueprint) {
         die("Este formulario no existe!");
     }
     $data = [];
     $data['blueprint'] = $blueprint;
     $data['title'] = 'Resultados | Tú Evalúas';
     $data['description'] = 'Resultados de cuestionarios en Tú Evalúas';
     $data['body_class'] = 'results';
     $data['test'] = $test;
     return view("frontend.result_survey")->with($data);
 }
开发者ID:GobiernoFacil,项目名称:tu-evaluas,代码行数:48,代码来源:Frontend.php

示例6: getCity

 public static function getCity($id)
 {
     $cities = City::where('state_id', '=', $id)->get(['name', 'id']);
     //echo ($cities);
     return response()->json($cities);
 }
开发者ID:mauhftw,项目名称:mizustats,代码行数:6,代码来源:UsersController.php

示例7: find_location

 private function find_location($question_type, $inegi_key)
 {
     if (!$inegi_key) {
         return "-";
     }
     switch ($question_type) {
         case "location-a":
             $key = substr($inegi_key->text_value, 0, 2);
             $name = !empty($key) ? $this->states[$key] : "-";
             break;
         case "location-b":
             $state_key = substr($inegi_key->text_value, 0, 2);
             $state_name = !empty($state_key) ? $this->states[$state_key] : "-";
             $city_key = substr($inegi_key->text_value, 2, 3);
             $city = !empty($city_key) ? City::where("clave", $city_key)->where("estado_id", (int) $state_key)->first() : null;
             $city_name = $city ? $city->nombre : "-";
             $name = $city_name . ", " . $state_name;
             break;
         case "location-c":
             $state_key = substr($inegi_key->text_value, 0, 2);
             $state_name = !empty($state_key) ? $this->states[$state_key] : "-";
             $city_key = substr($inegi_key->text_value, 2, 3);
             $city = !empty($city_key) ? City::where("clave", $city_key)->where("estado_id", (int) $state_key)->first() : null;
             $city_name = $city ? $city->nombre : "-";
             $location_key = substr($inegi_key->text_value, 5, 4);
             $location = !empty($location_key) ? Location::where("clave", $location_key)->where("municipio_id", $city->id)->first() : null;
             $location_name = $location ? $location->nombre : "-";
             $name = $location_name . ", " . $city_name . ", " . $state_name;
             break;
         default:
             $name = "-";
             break;
     }
     return $name;
 }
开发者ID:GobiernoFacil,项目名称:tu-evaluas,代码行数:35,代码来源:MakeXLSX.php

示例8: getTakeCity

 public function getTakeCity()
 {
     $state_id = \Request::input('province_id');
     $emptyData = [];
     if (empty($state_id)) {
         return $emptyData;
     }
     $queryCity = Md\City::where('state_id', '=', $state_id);
     $sites = $queryCity->lists('name', 'city_id');
     return $sites;
 }
开发者ID:Abdulhmid,项目名称:wecando,代码行数:11,代码来源:FrontendController.php

示例9: getCity

  public function getCity (Request $request) 
  {
    $province = $request->input('province');

    $cities = City::where('province_code', '=', $province)

      ->where('active', '=', 1)

      ->get();

    $html = $this->cityList($cities);

    return $this->successResponse('res', $html);
  
  }
开发者ID:kukujiabo,项目名称:linpai,代码行数:15,代码来源:LocationController.php


注:本文中的app\models\City::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。