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


PHP City::find方法代码示例

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


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

示例1: actionIndex

 /**
  * Lists all City models.
  * @return mixed
  */
 public function actionIndex()
 {
     //$params=Yii::$app->request->get();
     $params = $_REQUEST;
     $filter = array();
     $sort = "";
     $page = 1;
     $limit = 5;
     if (isset($params['page'])) {
         $page = $params['page'];
         unset($params['page']);
     }
     if (isset($params['limit'])) {
         $limit = $params['limit'];
         unset($params['limit']);
     }
     $offset = $limit * ($page - 1);
     if (isset($params['filter'])) {
         $filter = (array) json_decode($params['filter']);
     }
     if (isset($params['sort'])) {
         $sort = $params['sort'];
     }
     $models = City::find()->offset($offset)->limit($limit)->where($filter)->orderBy($sort)->all();
     $totalItems = City::find()->count();
     $data = array();
     foreach ($models as $m) {
         $data[] = $m->attributes;
     }
     $this->getHeader(200);
     echo json_encode(array('status' => 1, 'data' => $data, 'totalItems' => $totalItems), JSON_PRETTY_PRINT);
 }
开发者ID:tejrajs,项目名称:yii2RestAPI,代码行数:36,代码来源:CityController.php

示例2: actionDeliveryCost

 public function actionDeliveryCost($code)
 {
     //check the api for the returned data
     //check country
     $city = City::find()->where('Name="' . $code . '"')->one();
     //var_dump($city);
     if ($city->CountryCode == 'EGY') {
         //calculate weight
         $sum = 0;
         foreach (Shopcart::goods() as $good) {
             $sum += $good->item->product_weight;
         }
         // return "the new cost--".$city->Name .$city->CountryCode;
         //$city->CountryCode;
         $cost = $this->GetCost($city->Name, $sum);
         if ($cost == '' or $cost == 0) {
             return Setting::get('deliver_cost');
         } else {
             return $cost;
         }
     } else {
         return Setting::get('deliver_cost');
         //.'-99'. $city->CountryCode;
     }
 }
开发者ID:engmohamedamer,项目名称:gotest,代码行数:25,代码来源:ShopcartController.php

示例3: actionIndex

 public function actionIndex($mid = '', $f = 0)
 {
     $user = User::findIdentity(Yii::$app->user->id);
     $regFrm = new RegisterForm();
     $rstFrm = new RestorePswForm();
     $spOffs = new SpecialOffer();
     $spOffs = $spOffs->getAllSpecialOffers();
     if ($f) {
         $logFrm = new LoginForm(['scenario' => LoginForm::SCENARIO_LOGIN_CAPTCHA]);
     } else {
         $logFrm = new LoginForm(['scenario' => LoginForm::SCENARIO_LOGIN]);
     }
     $city = City::find()->all();
     $address = new Address();
     $distr = $address->getDistrict();
     $category = Category::find()->all();
     $brand = Brand::find()->all();
     $msg = '';
     switch ($mid) {
         case 1:
             $msg = Common::M_EMAIL_SEND;
             break;
         case 2:
             $msg = Common::M_PSW_EMAIL_SEND;
             break;
         case 3:
             $msg = Common::M_PSW_RESTORE_SUCCESS;
             break;
     }
     return $this->render('index', ['msg' => $msg, 'user' => $user, 'spOffs' => $spOffs, 'regFrm' => $regFrm, 'logFrm' => $logFrm, 'rstFrm' => $rstFrm, 'city' => $city, 'distr' => $distr, 'category' => $category, 'brand' => $brand]);
 }
开发者ID:Bibihelper,项目名称:Project2015,代码行数:31,代码来源:IndexController.php

示例4: actionGetorgcity

 public function actionGetorgcity($id)
 {
     $rows = \app\models\City::find()->where(['state_id' => $id, 'is_status' => 0])->ALL();
     echo Html::tag('option', Html::encode(Yii::t('app', '--- Select City ---')), ['value' => '']);
     foreach ($rows as $row) {
         echo Html::tag('option', Html::encode($row->city_name), ['value' => $row->city_id]);
     }
 }
开发者ID:EduSec,项目名称:EduSec,代码行数:8,代码来源:DependentController.php

示例5: actionIndex

 /**
  * Lists all Locale models.
  * @return mixed
  */
 public function actionIndex()
 {
     // $searchModel = new LocaleSearch();
     // $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $this->layout = 'main2';
     $model = City::find()->all();
     return $this->render('index', ['model' => $model]);
 }
开发者ID:frankpaul142,项目名称:chaide,代码行数:12,代码来源:LocaleController.php

示例6: actionGetRegionCities

 public function actionGetRegionCities($region_id)
 {
     $cities = \app\models\City::find()->where(['region_id' => $region_id])->all();
     $content = '';
     foreach ($cities as $city) {
         $content .= '<option value="' . $city->id . '">' . $city->title . '</option>';
     }
     return $content;
 }
开发者ID:islamham,项目名称:125ent,代码行数:9,代码来源:SiteController.php

示例7: selectLocation

 /**
  * @todo Save location by session
  *
  * @param \Illuminate\Http\Request $request
  * @param int                      $id City id
  *
  * @return Redirect
  */
 public function selectLocation($id)
 {
     $id = (int) $id;
     if (!is_null(City::find($id))) {
         Session::put(_const('SESSION_LOCATION'), $id);
         Session::save();
     }
     return redirect(route('front_home'));
 }
开发者ID:vuongabc92,项目名称:ot,代码行数:17,代码来源:HomeController.php

示例8: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'parent_id' => $this->parent_id, 'region_id' => $this->region_id, 'region_global_id' => $this->region_global_id, 'gmt' => $this->gmt, 'sort_id' => $this->sort_id, 'old_region_id' => $this->old_region_id, 'is_deleted' => $this->is_deleted, 'is_published' => $this->is_published, 'timezone' => $this->timezone]);
     $query->andFilterWhere(['like', 'id_1c', $this->id_1c])->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'region_1c', $this->region_1c])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'title_1c', $this->title_1c])->andFilterWhere(['like', 'geoip_city', $this->geoip_city])->andFilterWhere(['like', 'path', $this->path])->andFilterWhere(['like', 'alternative_path', $this->alternative_path])->andFilterWhere(['like', 'old_path', $this->old_path])->andFilterWhere(['like', 'service_center', $this->service_center])->andFilterWhere(['like', 'manufacturer_service_center', $this->manufacturer_service_center])->andFilterWhere(['like', 'yandex_confirm_code', $this->yandex_confirm_code])->andFilterWhere(['like', 'yandex_confirm_code_tp', $this->yandex_confirm_code_tp])->andFilterWhere(['like', 'yandex_confirm_code_bazar', $this->yandex_confirm_code_bazar]);
     return $dataProvider;
 }
开发者ID:Konsul117,项目名称:phonebook,代码行数:18,代码来源:CitySearch.php

示例9: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'createdAt' => $this->createdAt, 'updatedAt' => $this->updatedAt]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
开发者ID:tejrajs,项目名称:yii2RestAPI,代码行数:18,代码来源:CitySearch.php

示例10: actionEmp_p_city

 public function actionEmp_p_city($id)
 {
     $rows = \app\models\City::find()->where(['city_state_id' => $id, 'is_status' => 0])->all();
     echo "<option value=''>---Select City---</option>";
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             echo "<option value='{$row->city_id}'>{$row->city_name}</option>";
         }
     } else {
         echo "";
     }
 }
开发者ID:aoopvn,项目名称:EduSec4.0.0,代码行数:12,代码来源:DependentController.php

示例11: actionFillTeams

 public function actionFillTeams()
 {
     foreach ($this->arrOfTeams as $team => $city) {
         $model = new Khlteams();
         $model->name = $team;
         $city_id = City::find()->where("name like('" . $city . "')")->one()->id;
         if (!$city_id) {
             $city_id = 1513;
         }
         $model->city_id = $city_id;
         $model->save(false);
     }
 }
开发者ID:roman1970,项目名称:lis,代码行数:13,代码来源:KhlController.php

示例12: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'country_id' => $this->country_id, 'state_id' => $this->state_id, 'created_by' => $this->created_by, 'modified_by' => $this->modified_by, 'created_date' => $this->created_date, 'modified_date' => $this->modified_date]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
开发者ID:damisadam,项目名称:FMS,代码行数:21,代码来源:CitySearch.php

示例13: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'have_event' => $this->have_event]);
     $query->andFilterWhere(['like', 'title_uk', $this->title_uk])->andFilterWhere(['like', 'title_ru', $this->title_ru])->andFilterWhere(['like', 'title_en', $this->title_en]);
     return $dataProvider;
 }
开发者ID:unix-admin,项目名称:profitday,代码行数:21,代码来源:CitySearch.php

示例14: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'province_id' => $this->province_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'citycol', $this->citycol]);
     return $dataProvider;
 }
开发者ID:sudaswani,项目名称:sudaswani-apc-softdev-gd121mi122-07,代码行数:21,代码来源:CitySearch.php

示例15: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'rec_status_id' => $this->rec_status_id, 'user_id' => $this->user_id, 'dc' => $this->dc]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'note', $this->note]);
     return $dataProvider;
 }
开发者ID:slavam,项目名称:placement,代码行数:21,代码来源:CitySearch.php


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