Exemplo n.º 1
0
 public function ejecutar_alimento(Request $request)
 {
     $rules = array('dose' => 'required', 'responsible' => 'required');
     $this->validate($request, $rules);
     $dateA = Input::get('dateApplication');
     $dateApplication = date(microtime(substr($dateA, 6, 4) . "-" . substr($dateA, 3, 2) . "-" . substr($dateA, 0, 2) . " " . substr($dateA, 10, 6)) * 10000);
     $boosterI = Input::get('boosterInjection');
     $boosterInjection = date(microtime(substr($dateA, 6, 4) . "-" . substr($dateA, 3, 2) . "-" . substr($dateA, 0, 2) . " " . substr($dateA, 10, 6)) * 10000);
     $price = Food_Supplement::where('id', $request->food_supplements)->pluck('price_kg');
     //$animalName=Animal::where('id',$request->animalName)->pluck('nombre');
     //$food_supplement=Food_Supplement::where('id',$request->food_supplements)->pluck('nameProduct');
     $dc = new DietaryControl();
     $dc->idUser = Auth::id();
     $dc->idAnimal = $request->animalName;
     $dc->idFood_Supplemet = $request->food_supplements;
     $dc->dateApplication = $request->dateApplication;
     $dc->Dosage = $request->dose;
     $dc->value = $request->dose * $price;
     $dc->responsible = $request->responsible;
     $dc->save();
     $event = new Calendar();
     $event->idUser = Auth::id();
     $event->title = 'Alimentacion';
     $event->body = 'Programada';
     $event->url = 'http://localhost:8000/vaccinationControl';
     $event->class = 'Preventivo';
     $event->start = $dateApplication;
     $event->end = $boosterInjection;
     $event->save();
     return redirect()->route('animal.index');
 }
 public function show1($id)
 {
     $food__supplements = Food_Supplement::where('id', $id)->get();
     return view('food__supplements.show1', compact('food__supplements'));
 }