/** * Retrieves a list of models based on the current search/filter conditions. * * Typical usecase: * - Initialize the model fields with values from filter form. * - Execute this method to get CActiveDataProvider instance which will filter * models according to data in model fields. * - Pass data provider to CGridView, CListView or any similar widget. * * @return CActiveDataProvider the data provider that can return the models * based on the search/filter conditions. */ public function search($params) { $query = DatabasesPerm::find(); $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query, "sort" => ['defaultOrder' => []]]); //exit; $this->load($params); if (!$this->validate()) { var_dump($this->getErrors()); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'database_id' => $this->database_id, 'level_id' => $this->level_id]); //$sort->defaultOrder = 'issue_date DESC'; return $dataProvider; }