public function getRegionList($country_id){
$model = frontend\models\Region::find()->where(['country_id'=> $country_id])->asArray()->all();
if ($model === null) {
echo "Список пустой";
} else {
return ArrayHelper::map($model, 'region_id', 'name');
}
}
public function getRegionList($country_id){
$model = frontend\models\Region::find()->where(['country_id'=> $country_id])->saArray()->all();
return ArrayHelper::map($models, 'region_id', 'name');
}
public function getCityList($country_id, $region_id){
$model = frontend\models\City::find()->where(['country_id'=> $country_id])->saArray()->all();
return ArrayHelper::map($models, 'city_id', 'name');
}
<?php
namespace frontend\views\site;
use frontend\models\Region;
$model = Region::find()->where(['country_id'=> $country_id])->saArray()->all();
?>
<?php
public function getRegionList($country_id){
return ArrayHelper::map($models, 'region_id', 'name');
}
?>