Beispiel #1
0
 public function getFosters()
 {
     $search = Input::get('term');
     //   Log::info('getFosters: '.$search);
     $data = Animal::orderBy('foster', 'ASC')->distinct()->get(array('foster'))->lists('foster');
     return $data;
 }
Beispiel #2
0
 /**
  * @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;
 }
Beispiel #3
0
 /**
  * @return Response
  */
 public function index()
 {
     Animal::truncate();
     $animals = Import::all();
     $breeds = Breed::where('species', '=', 'Dog')->orderBy('name')->lists('name', 'id');
     $stati = \Config::get('rescue.status');
     $no_breed = \Config::get('rescue.select_breed_id');
     foreach ($animals as $animal) {
         $pri_breed_id = array_search($animal->pri_breed, $breeds);
         if (FALSE != $pri_breed_id) {
             $sec_breed_id = array_search($animal->sec_breed, $breeds);
             if (FALSE == $sec_breed_id) {
                 $sec_breed_id = $no_breed;
             }
             $status = array_search($animal->status, $stati);
             if (FALSE == $status) {
                 $status = 0;
             }
             Animal::create(array('id' => $animal, 'name' => $animal->name, 'species' => $animal->species, 'pri_breed_id' => $pri_breed_id, 'sec_breed_id' => $sec_breed_id, 'mixed_breed' => $animal->mix == '1' ? TRUE : FALSE, 'date_of_birth' => $animal->date_of_birth, 'gender' => $animal->gender, 'altered' => $animal->altered == 1 ? TRUE : FALSE, 'intake_date' => $animal->intake_date, 'status_id' => $status, 'status_date' => $animal->status_date, 'foster' => $animal->foster, 'picture' => $animal->picture, 'description' => $animal->description));
         }
     }
     return '<h2>Import Complete: ' . Animal::Count() . ' Records Imported</h2>';
 }
Beispiel #4
0
 /**
  * Finds the Animal model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Animal the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Animal::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdanimal0()
 {
     return $this->hasOne(Animal::className(), ['idanimal' => 'idanimal']);
 }
Beispiel #6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     print $id;
     Animal::raw_delete($id);
     return redirect()->route('animal.index');
 }
 private function warm()
 {
     Animal::find()->one()->name;
     StaticAnimal::find()->one()->name;
 }