public function search($params) { $query = Hotels::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->andFilterWhere([Hotels::tableName() . '.status' => '1']); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['Id' => $this->Id, 'type' => $this->type, 'cityId' => $this->cityId, 'localityId' => $this->localityId, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'status' => $this->status, 'parent_city_id' => $this->parent_city_id]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }