/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = User::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'role' => $this->role, 'status' => $this->status, 'last_visit_at' => $this->last_visit_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'access_token', $this->access_token])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'real_name', $this->real_name])->andFilterWhere(['like', 'avatar', $this->avatar]); return $dataProvider; }
/** * @return string */ public function actionInstall() { //Check users count if (User::find()->count() > 0) { return $this->redirect(['index']); } $this->layout = 'base'; $model = new SignupForm(); if ($model->load(Yii::$app->request->post()) && ($user = $model->signup())) { //Update roles RoleController::updateRoles(true, $user->id, $this->module->superUserRole); return $this->redirect(['index']); } else { return $this->render('signup', ['model' => $model]); } }