/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = RequestType::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(['type_id' => $this->type_id]); $query->andFilterWhere(['like', 'request_name', $this->request_name])->andFilterWhere(['like', 'req_type', $this->req_type])->andFilterWhere(['like', 'date_in', $this->date_in]); return $dataProvider; }
<?php use yii\helpers\Html; //use yii\widgets\ActiveForm; use kartik\widgets\ActiveForm; use kartik\widgets\DatePicker; use app\models\RequestType; use yii\helpers\ArrayHelper; use app\models\Staff; /* @var $this yii\web\View */ /* @var $model app\models\RequestDic */ /* @var $form yii\widgets\ActiveForm */ ?> <?php $RequestType = RequestType::find()->all(); $arraytype = ArrayHelper::map($RequestType, 'type_id', 'request_name'); $Staff = Staff::find()->all(); $arrayStaff = ArrayHelper::map($Staff, 'staff_id', 'name'); if (isset($erros)) { echo Alert::widget(['options' => ['class' => 'alert-info'], 'body' => $erros]); } ?> <div class="request-dic-form"> <?php $form = ActiveForm::begin(); ?> <?php