models/ApartmentSearch.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 = Apartment::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            'id' => $this->id,
            'city_id' => $this->city_id,
            'area_id' => $this->area_id,
            'street_id' => $this->street_id,
            'home' => $this->home,
            'apartment' => $this->apartment,
            'rooms' => $this->rooms,
            'house_type_id' => $this->house_type_id,
            'quadrature' => $this->quadrature,
            'elevator' => $this->elevator,
            'price' => $this->price,
            'stage_complete' => $this->stage_complete,
            'payment' => $this->payment,
            'layout_type' => $this->layout_type,
            'user_id' => $this->user_id,
            'date_create' => $this->date_create,
            'date_update' => $this->date_update,
            'status' => $this->status,
        ]);
        $query->andFilterWhere(['like', 'storey', $this->storey])
            ->andFilterWhere(['like', 'rights_house', $this->rights_house])
            ->andFilterWhere(['like', 'comments', $this->comments]);
        return $dataProvider;
    }
public function search ( $ params ) { $ query = Apartment :: find ( ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , ] ) ; $ this -> load ( $ params ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } $ query -> andFilterWhere ( [ 'id' => $ this -> id , 'city_id' => $ this -> city_id , 'area_id' => $ this -> area_id , 'street_id' => $ this -> street_id , 'home' => $ this -> home , 'apartment' => $ this -> apartment , 'rooms' => $ this -> rooms , 'house_type_id' => $ this -> house_type_id , 'quadrature' => $ this -> quadrature , 'elevator' => $ this -> elevator , 'price' => $ this -> price , 'stage_complete' => $ this -> stage_complete , 'payment' => $ this -> payment , 'layout_type' => $ this -> layout_type , 'user_id' => $ this -> user_id , 'date_create' => $ this -> date_create , 'date_update' => $ this -> date_update , 'status' => $ this -> status , ] ) ; $ query -> andFilterWhere ( [ 'like' , 'storey' , $ this -> storey ] ) -> andFilterWhere ( [ 'like' , 'rights_house' , $ this -> rights_house ] ) -> andFilterWhere ( [ 'like' , 'comments' , $ this -> comments ] ) ; 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 // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); // grid filtering conditions