/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $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($boosterI, 6, 4) . "-" . substr($boosterI, 3, 2) . "-" . substr($boosterI, 0, 2) . " " . substr($boosterI, 10, 6)) * 10000);
     //dd($request->diseaseName);
     $animalName = Animal::where('id', $request->animalName)->pluck('nombre');
     $diseaseName = Disease::where('id', $request->diseaseName)->pluck('name');
     $vaccineName = Vaccine::where('id', $request->vaccineName)->pluck('name');
     $vc = new VaccinationControl();
     $vc->idUser = Auth::id();
     $vc->animalName = $animalName;
     $vc->diseaseName = $diseaseName;
     $vc->vaccineName = $vaccineName;
     $vc->dateApplication = Input::get('dateApplication');
     $vc->dose = Input::get('dose');
     $vc->responsible = Input::get('responsible');
     $vc->boosterInjection = Input::get('boosterInjection');
     //dd($vc);
     $vc->save();
     $event = new Calendar();
     $event->idUser = Auth::id();
     $event->title = 'Vacunacion';
     $event->body = 'Programada';
     $event->url = 'http://localhost:8000/vaccinationControl';
     $event->class = 'Preventivo';
     $event->start = $dateApplication;
     $event->end = $boosterInjection;
     $event->save();
     return redirect()->route('vaccinationControl.show');
 }
Exemplo n.º 2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     $animals = Animal::where('idUser', Auth::id())->where('id', $request->id)->get();
     $vaccines = VaccinationControl::where('vaccination_controls.idUser', Auth::id())->where('vaccination_controls.animalName', $request->id)->join('vaccines', 'vaccines.id', '=', 'vaccination_controls.vaccineName')->join('diseases', 'diseases.id', '=', 'vaccination_controls.diseaseName')->select('vaccines.nameV', 'diseases.name', 'vaccination_controls.dateApplication', 'vaccination_controls.dose')->get();
     $injecctions = InjecctionControl::where('injecction_controls.idUser', Auth::id())->where('injecction_controls.animalName', $request->id)->join('injections', 'injections.id', '=', 'injecction_controls.injectionName')->join('diseases', 'diseases.id', '=', 'injecction_controls.diseaseName')->select('injections.name', 'diseases.name', 'injecction_controls.dateApplication', 'injecction_controls.dose')->get();
     $animal = Animal::where('id', $request->id)->get();
     return view('reports.show', compact('animals', 'vaccines', 'injecctions', 'animal'));
 }
Exemplo n.º 3
0
 public function milk_production($id)
 {
     $animals = Animal::where('idUser', Auth::id())->get();
     return view('animals.milk_production', compact('animals'));
 }