public function validateStructID($attribute, $params) { $tree = Yii::$app->settings->get('staff.tree'); $struct = Structure::find()->where(['id' => $this->{$attribute}, 'tree' => $tree])->one(); if ($struct) { $this->orgid = $struct->tree; } else { $this->addError('structid', Module::t('staff', 'Structure not found')); } }
/** * Lists all Structure models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Structure::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
/** * Lists all Structure models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Structure::find()->where(['tree' => Yii::$app->settings->get('staff.tree')])]); return $this->render('index', ['dataProvider' => $dataProvider]); }