コード例 #1
0
 public function actionDistricts()
 {
     $country = Yii::$app->request->post('country');
     if (empty($country) || $country === 'undefined') {
         return null;
     }
     $province = Yii::$app->request->post('province');
     if (empty($province) || $province === 'undefined') {
         return null;
     }
     $city = Yii::$app->request->post('city');
     if (empty($city) || $city === 'undefined') {
         return null;
     }
     return District::asArray(Country::get($country)->getProvince($province)->getCity($city)->districts);
 }
コード例 #2
0
ファイル: City.php プロジェクト: rhosocial/rho.social
 /**
  * 
  * @param string $alpha
  * @return District
  */
 public function getDistrict($alpha)
 {
     return District::find()->where(['alpha' => $alpha, 'city' => $this->alpha, 'province' => $this->province, 'country' => $this->country])->one();
 }