backend/models/search/SoftwareSearch.php
/**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
Creates data provider instance with search query applied
@param array $params


Creates data provider instance with search query applied @param array $params
public function search($params)
    {
        $query = Software::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort'=> [
                'defaultOrder' => ['software_sort'=>SORT_ASC],
                'attributes' => [
                    'software_id',
                    'software_sort',
                    'software_status',
                    'software_type',
                    'software_version',
                    'software_created',
                    'software_updated',
                ]
            ],
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            'software_id' => $this->software_id,
            'software_created' => $this->software_created,
            'software_updated' => $this->software_updated,
            'software_status' => $this->software_status,
        ]);
        $query->andFilterWhere(['like', 'software_type', $this->software_type])
            ->andFilterWhere(['like', 'software_description', $this->software_description])
            ->andFilterWhere(['like', 'software_file_name', $this->software_file_name])
            ->andFilterWhere(['like', 'software_version', $this->software_version]);
        return $dataProvider;
    }
public function search ( $ params ) { $ query = Software :: find ( ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , 'sort' => [ 'defaultOrder' => [ 'software_sort' => SORT_ASC ] , 'attributes' => [ 'software_id' , 'software_sort' , 'software_status' , 'software_type' , 'software_version' , 'software_created' , 'software_updated' , ] ] , ] ) ; $ this -> load ( $ params ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } $ query -> andFilterWhere ( [ 'software_id' => $ this -> software_id , 'software_created' => $ this -> software_created , 'software_updated' => $ this -> software_updated , 'software_status' => $ this -> software_status , ] ) ; $ query -> andFilterWhere ( [ 'like' , 'software_type' , $ this -> software_type ] ) -> andFilterWhere ( [ 'like' , 'software_description' , $ this -> software_description ] ) -> andFilterWhere ( [ 'like' , 'software_file_name' , $ this -> software_file_name ] ) -> andFilterWhere ( [ 'like' , 'software_version' , $ this -> software_version ] ) ; return $ dataProvider ; }
Creates data provider instance with search query applied
 @param array $params
Creates data provider instance with search query applied @param array $params
// add conditions that should always apply here /*
            'pagination' => [
                'pageSize' => 100,
                'route' => 'software/index',
            ],
            */ // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); // grid filtering conditions