예제 #1
0
 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, 'status' => $this->status, 'password_fail_attempts' => $this->password_fail_attempts, 'last_login_on' => $this->last_login_on, 'password_reset_on' => $this->password_reset_on, 'created_on' => $this->created_on, 'updated_on' => $this->updated_on]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'activation_key', $this->activation_key])->andFilterWhere(['like', 'reset_key', $this->reset_key])->andFilterWhere(['like', 'last_login_ip', $this->last_login_ip]);
     return $dataProvider;
 }
예제 #2
0
파일: Module.php 프로젝트: imagis/yii2-user
 /**
  * Superuser already exists in the database?
  * @return bool
  */
 public function hasSuperUser()
 {
     return count(User::find()->superuser()->all()) > 0;
 }