/** * @param $params critères de la recherche * @action effectue la recherche sur les chiens * @return le resultat de la recherche */ public function searchChat($params) { $query = Animal::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(['idanimal' => $this->idanimal, 'dateNaissance' => $this->dateNaissance, 'chienDuMois' => $this->chienDuMois, 'coupDeCoeur' => $this->coupDeCoeur]); $query->andFilterWhere(['like', 'type', 'chat'])->andFilterWhere(['like', 'zone', $this->zone])->andFilterWhere(['like', 'etat', 'adoptable'])->andFilterWhere(['like', 'nom', $this->nom])->andFilterWhere(['like', 'sexe', $this->sexe])->andFilterWhere(['like', 'sterilise', $this->sterilise])->andFilterWhere(['like', 'race', $this->race])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'ententeChiens', $this->ententeChiens])->andFilterWhere(['like', 'ententeChats', $this->ententeChats])->andFilterWhere(['like', 'ententeEnfants', $this->ententeEnfants]); return $dataProvider; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $animal = Animal::find($id); $animal->delete(); return Redirect::route('animal.index'); }
private function warm() { Animal::find()->one()->name; StaticAnimal::find()->one()->name; }