|
- <?php
-
- namespace common\models;
-
- use Yii;
- use yii\base\Model;
- use yii\data\ActiveDataProvider;
- use common\models\BaseRole;
-
- /**
- * searchRole represents the model behind the search form about `common\models\BaseRole`.
- */
- class searchRole extends BaseRole
- {
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['ID', 'PARENT_MENU_ID', 'CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID', 'SEQ'], 'integer'],
- [['MENU_TITLE', 'ROLE_NAME', 'MENU_ICON', 'CREATE_TIME', 'UPDATE_TIME', 'TARGET', 'NOTE'], 'safe'],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function scenarios()
- {
- // bypass scenarios() implementation in the parent class
- return Model::scenarios();
- }
-
- /**
- * Creates data provider instance with search query applied
- *
- * @param array $params
- *
- * @return ActiveDataProvider
- */
- public function search($params)
- {
- $query = BaseRole::find();
-
- // add conditions that should always apply here
-
- $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;
- }
-
- // grid filtering conditions
- $query->andFilterWhere([
- 'ID' => $this->ID,
- 'ROLE_SYS' => $this->ROLE_SYS,
- 'PARENT_MENU_ID' => $this->PARENT_MENU_ID,
- 'CANCEL_FLAG' => $this->CANCEL_FLAG,
- 'CREATE_USER_ID' => $this->CREATE_USER_ID,
- 'UPDATE_USER_ID' => $this->UPDATE_USER_ID,
- 'SEQ' => $this->SEQ,
- ]);
-
- $query->andFilterWhere(['like', 'MENU_TITLE', $this->MENU_TITLE])
- ->andFilterWhere(['like', 'ROLE_NAME', $this->ROLE_NAME])
- ->andFilterWhere(['like', 'MENU_ICON', $this->MENU_ICON])
- ->andFilterWhere(['like', 'CREATE_TIME', $this->CREATE_TIME])
- ->andFilterWhere(['like', 'UPDATE_TIME', $this->UPDATE_TIME])
- ->andFilterWhere(['like', 'TARGET', $this->TARGET])
- ->andFilterWhere(['like', 'NOTE', $this->NOTE]);
-
- return $dataProvider;
- }
- }
|