/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Incident::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'date' => $this->date, 'equipment_id' => $this->equipment_id, 'room_id' => $this->room_id, 'solved' => $this->solved, 'date_solved' => $this->date_solved, 'client_id' => $this->client_id, 'user_id' => $this->user_id]); $query->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Incident::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'raptor_id' => $this->raptor_id, 'nearest_city_id' => $this->nearest_city_id, 'hy' => $this->hy, 'a' => $this->a, 'orphan' => $this->orphan, 'oiled' => $this->oiled, 'leg_hold_trap' => $this->leg_hold_trap, 'methane_burner' => $this->methane_burner, 'wind_turbine' => $this->wind_turbine, 'gunshot' => $this->gunshot, 'hvt' => $this->hvt, 'window_strike' => $this->window_strike, 'hbc' => $this->hbc, 'cbc' => $this->cbc, 'head_spinal_trama' => $this->head_spinal_trama, 'wnv' => $this->wnv, 'emaciated' => $this->emaciated, 'disposition_date' => $this->disposition_date, 'end_of_stay' => $this->end_of_stay, 'released' => $this->released, 'died' => $this->died, 'died_48' => $this->died_48, 'died_96' => $this->died_96, 'euthanized' => $this->euthanized, 'euthanized_48' => $this->euthanized_48, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'zip', $this->zip])->andFilterWhere(['like', 'county', $this->county])->andFilterWhere(['like', 'lat', $this->lat])->andFilterWhere(['like', 'lon', $this->lon])->andFilterWhere(['like', 'lead_value', $this->lead_value])->andFilterWhere(['like', 'fx', $this->fx])->andFilterWhere(['like', 'suspected_injury', $this->suspected_injury])->andFilterWhere(['like', 'disposition', $this->disposition]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Incident::find(); $query->joinWith(['equipment', 'room', 'client', 'user']); $dataProvider = new ActiveDataProvider(['query' => $query]); $dataProvider->sort->attributes['equipment'] = ['asc' => ['equipment.inventory' => SORT_ASC], 'desc' => ['equipment.inventory' => SORT_DESC]]; $dataProvider->sort->attributes['room'] = ['asc' => ['room.name' => SORT_ASC], 'desc' => ['room.name' => SORT_DESC]]; $dataProvider->sort->attributes['client'] = ['asc' => ['client.client_id' => SORT_ASC], 'desc' => ['client.client_id' => SORT_DESC]]; $dataProvider->sort->attributes['user'] = ['asc' => ['user.user_name' => SORT_ASC], 'desc' => ['user.user_name' => SORT_DESC]]; $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'solved' => $this->solved, 'date_solved' => $this->date_solved]); $query->andFilterWhere(['like', 'incident.description', $this->description])->andFilterWhere(['like', 'date', $this->date])->andFilterWhere(['like', 'equipment.inventory', $this->equipment])->andFilterWhere(['like', 'room.name', $this->room])->andFilterWhere(['like', 'client.client_id', $this->client])->andFilterWhere(['like', 'user.user_name', $this->user]); return $dataProvider; }