當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。