/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = AuthRule::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(['created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'data', $this->data]); return $dataProvider; }
?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'type')->dropDownList(array('1' => 'Role', '2' => 'Permission')); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'rule_name')->widget(Select2::classname(), ['data' => ArrayHelper::map(AuthRule::find()->all(), 'name', 'name'), 'language' => 'en', 'options' => ['placeholder' => 'Please Select']]); ?> <?php echo $form->field($model, 'data')->textarea(['rows' => 6]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>