/** * Runs the action. */ public function run() { $params = Yii::$app->request->post('depdrop_all_params'); $parents = Yii::$app->request->post('depdrop_parents'); $_output = []; if ($this->type == 'city') { $_output = ProvinceCityDistrict::find()->where(['level' => 2, 'upid' => $params['province-id']])->all(); } else { if ($this->type == 'district') { $_output = ProvinceCityDistrict::find()->where(['level' => 3, 'upid' => $params['city-id']])->all(); } } $_output = ArrayHelper::getArrayAttr($_output, ['id', 'name']); return Json::encode(['output' => $_output, 'selected' => '']); }