models/search/BookSearch.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 = Book::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            'id' => $this->id,
            'author_id' => $this->author_id,
            'date' => $this->date,
        ]);
        $query->andFilterWhere([
            'between', 'date', $this->dateFrom, $this->dateTo,
        ])->andFilterWhere(['like', 'name', $this->name]);
        return $dataProvider;
    }
public function search ( $ params ) { $ query = Book :: find ( ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , ] ) ; $ this -> load ( $ params ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } $ query -> andFilterWhere ( [ 'id' => $ this -> id , 'author_id' => $ this -> author_id , 'date' => $ this -> date , ] ) ; $ query -> andFilterWhere ( [ 'between' , 'date' , $ this -> dateFrom , $ this -> dateTo , ] ) -> andFilterWhere ( [ 'like' , 'name' , $ this -> name ] ) ; return $ dataProvider ; }
Creates data provider instance with search query applied
 @param array $params
Creates data provider instance with search query applied @param array $params