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


PHP Country::find方法代码示例

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


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

示例1: getLicensePaymentDetails

 /**
  * @param array $input
  * @param Affiliate $affiliate
  *
  * @return array
  */
 private function getLicensePaymentDetails(array $input, Affiliate $affiliate)
 {
     $country = Country::find($input['country_id']);
     $data = ['firstName' => $input['first_name'], 'lastName' => $input['last_name'], 'email' => $input['email'], 'number' => $input['card_number'], 'expiryMonth' => $input['expiration_month'], 'expiryYear' => $input['expiration_year'], 'cvv' => $input['cvv'], 'billingAddress1' => $input['address1'], 'billingAddress2' => $input['address2'], 'billingCity' => $input['city'], 'billingState' => $input['state'], 'billingPostcode' => $input['postal_code'], 'billingCountry' => $country->iso_3166_2, 'shippingAddress1' => $input['address1'], 'shippingAddress2' => $input['address2'], 'shippingCity' => $input['city'], 'shippingState' => $input['state'], 'shippingPostcode' => $input['postal_code'], 'shippingCountry' => $country->iso_3166_2];
     $card = new CreditCard($data);
     return ['amount' => $affiliate->price, 'card' => $card, 'currency' => 'USD', 'returnUrl' => URL::to('license_complete'), 'cancelUrl' => URL::to('/')];
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:13,代码来源:NinjaController.php

示例2: actionIndex

 public function actionIndex()
 {
     $query = Country::find();
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $countries = $query->orderBy('name')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('index', ['countries' => $countries, 'pagination' => $pagination]);
 }
开发者ID:mapuchila,项目名称:Yii2-App,代码行数:7,代码来源:CountryController.php

示例3: actionTest

 public function actionTest()
 {
     $result = Country::find()->orderBy('population DESC')->all();
     //获取全部
     //var_dump($result);exit();
     return $this->render('test', ['result' => $result]);
 }
开发者ID:JorsonChen,项目名称:yiibasic,代码行数:7,代码来源:CountryController.php

示例4: getCountries

 public function getCountries()
 {
     $ret = [];
     foreach (Country::find()->all() as $cc) {
         $ret[$cc->key] = $cc->id;
     }
     return $ret;
 }
开发者ID:frozenpandaman,项目名称:stat.ink,代码行数:8,代码来源:m160108_142541_tz_country.php

示例5: actionIndex

 public function actionIndex()
 {
     $country = new Country();
     echo PRE;
     $query = Country::find();
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $countries = $query->orderBy('name')->offset($pagination->offset)->limit($pagination->limit)->all();
 }
开发者ID:huangsen0912,项目名称:yii2-rest-api-Basic-Application-Template-,代码行数:8,代码来源:CountryController.php

示例6: actionIndex

 public function actionIndex()
 {
     $query = Country::find();
     //$query = Country::find()->andWhere(['code'=>'AU']);
     //初始化分页
     $pagination = new Pagination(['pageSize' => 2, 'totalCount' => $query->count()]);
     $countries = $query->orderBy('name')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('index', ['countries' => $countries, 'pagination' => $pagination]);
 }
开发者ID:arkulo56,项目名称:my_program,代码行数:9,代码来源:CountryController.php

示例7: convertInputForOmnipay

 public function convertInputForOmnipay($input)
 {
     $data = ['firstName' => $input['first_name'], 'lastName' => $input['last_name'], 'number' => $input['card_number'], 'expiryMonth' => $input['expiration_month'], 'expiryYear' => $input['expiration_year'], 'cvv' => $input['cvv']];
     if (isset($input['country_id'])) {
         $country = Country::find($input['country_id']);
         $data = array_merge($data, ['billingAddress1' => $input['address1'], 'billingAddress2' => $input['address2'], 'billingCity' => $input['city'], 'billingState' => $input['state'], 'billingPostcode' => $input['postal_code'], 'billingCountry' => $country->iso_3166_2, 'shippingAddress1' => $input['address1'], 'shippingAddress2' => $input['address2'], 'shippingCity' => $input['city'], 'shippingState' => $input['state'], 'shippingPostcode' => $input['postal_code'], 'shippingCountry' => $country->iso_3166_2]);
     }
     return $data;
 }
开发者ID:nafrente,项目名称:invoice-ninja,代码行数:9,代码来源:PaymentService.php

示例8: actionCountry

 public function actionCountry()
 {
     $countries = Country::find()->orderBy('name desc')->all();
     echo \yii\helpers\Json::encode($countries);
     $countryUs = Country::findOne('US');
     echo '<br />' . \yii\helpers\Json::encode($countryUs);
     $countryUs->name = 'U.S.A.';
     echo $countryUs->save() ? '  OK' : '  False';
 }
开发者ID:xiaosongluffy,项目名称:yiilearn,代码行数:9,代码来源:SiteController.php

示例9: getState

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

示例10: getAttack

 public function getAttack($playerHash, $countryIdFrom, $countryIdTo)
 {
     $from = Country::find($countryIdFrom);
     /** @var $from Country */
     $to = Country::find($countryIdTo);
     $player = Player::getByHash($playerHash);
     if ($from->isOwnedBy($player)) {
         Action::attack($from, $to);
     }
 }
开发者ID:JJacobi13,项目名称:jcAiBattle,代码行数:10,代码来源:GameController.php

示例11: sender

 public static function sender()
 {
     //todo: move to database
     switch (Auth::user()->user_id) {
         default:
         case 4916903:
             return new self(['first_name' => 'osu!store', 'last_name' => '', 'street' => 'Room 304, Build 700 Nishijin 7-7-1', 'city' => 'Sawara', 'state' => 'Fukuoka', 'zip' => '814-0002', 'country' => Country::find('JP'), 'phone' => '+819064201305']);
         case 2:
             return new self(['first_name' => 'osu!store', 'last_name' => '', 'street' => 'Nishi-Ooi 4-21-3 Birdie House A', 'city' => 'Shinagawa', 'state' => 'Tokyo', 'zip' => '140-0015', 'country' => Country::find('JP'), 'phone' => '+818013811430']);
     }
 }
开发者ID:Bobo1239,项目名称:osu-web,代码行数:11,代码来源:Address.php

示例12: search

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

示例13: actionUpdate

 /**
  * Updates an existing Address model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $countries = ArrayHelper::map(Country::find()->all(), 'country_id', 'country');
     $cities = ArrayHelper::map(City::find()->all(), 'city_id', 'city');
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->address_id]);
     } else {
         return $this->render('update', ['model' => $model, 'countries' => $countries, 'cities' => $cities]);
     }
 }
开发者ID:NightWatch-BG,项目名称:sglobka,代码行数:17,代码来源:AddressController.php

示例14: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSizeLimit' => [10, 100]], 'sort' => ['defaultOrder' => ['name' => SORT_ASC]]]);
     $params = $this->processParams($params);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'code', $this->code]);
     return $dataProvider;
 }
开发者ID:vsguts,项目名称:crm,代码行数:19,代码来源:CountrySearch.php

示例15: actionIndex

 /**
  * Lists all CountryData models.
  * @return mixed
  */
 public function actionIndex()
 {
     $model = Country::find()->all();
     $file = Yii::$app->basePath . '/data/BP-各国能源具体数据-20151206.xlsx';
     $PHPExcel = \PHPExcel_IOFactory::load($file);
     $sheet = $PHPExcel->getSheet(5);
     // 读取第一個工作表(编号从 0 开始)
     $highestRow = $sheet->getHighestRow();
     // 取得总行数
     $highestColumm = $sheet->getHighestColumn();
     // 取得总列数
     // $years = 2014-1965+1;
     // for($row = 4; $row <= $highestRow; $row++){
     //   $org = array();
     //   $country = null;
     //   $data_key = null;
     //   $data_value = null;
     //   $flag = true;
     // // $row = 5;
     //   for ($column = 0; $column <= $years; $column++) {
     //     $column_name = \PHPExcel_Cell::stringFromColumnIndex($column);
     //     $val = (string)$sheet->getCell($column_name.$row)->getValue();
     //     if($column == 0){
     //       if($val == "US"){
     //         $val = "United States";
     //       }
     //       if($val == "Trinidad & Tobago"){
     //         $val = "Trinidad and Tobago";
     //       }
     //       $country_model = Country::find()->where([
     //           'name_english' => $val,
     //       ])->one();
     //       if(!isset($country_model->id)){
     //         $country = null;
     //         continue;
     //       }else{
     //         $country = $country_model->id;
     //       }
     //     }
     //     if($column >=1 && trim($val)!="" && $country){
     //       $model = new CountryData();
     //       $model->country_id = $country;
     //       $model->data_key = "oil_consumption_barrels";
     //       $model->data_value = $val;
     //       $y = 1965 + $column - 1;
     //       $model->data_version = (string)$y;
     //       $model->save();
     //     }
     //   }
     // }
     return $this->render('index', ['model' => $model]);
 }
开发者ID:sanmaowang,项目名称:energy-app,代码行数:56,代码来源:CountryDataController.php


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