/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = userAdmin::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['usr_is_teacher' => $this->usr_is_teacher, 'usr_is_admin' => $this->usr_is_admin, 'usr_is_su' => $this->usr_is_su, 'usr_type_id' => $this->usr_type_id, 'usr_active' => $this->usr_active]); $query->andFilterWhere(['like', 'usr_id', $this->usr_id])->andFilterWhere(['like', 'usr_name', $this->usr_name])->andFilterWhere(['like', 'usr_pass', $this->usr_pass])->andFilterWhere(['like', 'usr_email', $this->usr_email])->andFilterWhere(['like', 'usr_secq', $this->usr_secq])->andFilterWhere(['like', 'usr_seca', $this->usr_seca]); return $dataProvider; }
/** * Finds the user model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return user the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = userAdmin::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }