Ejemplo n.º 1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request)
 {
     if ($request->name == "") {
         $providers = Defoult::where('name', 'no_found')->get();
         return view('providers.show', compact('providers'));
     } else {
         $providers = Provider::where('name', 'ILIKE', '%' . trim($request->get(trim('name'))) . '%')->get();
         if (sizeof($providers) == 0) {
             $providers = Defoult::where('name', 'no_found')->get();
             return view('providers.show', compact('providers'));
         }
         $providers = Provider::where('name', 'ILIKE', '%' . trim($request->get(trim('name'))) . '%')->get();
         return view('providers.show', compact('providers'));
     }
 }
Ejemplo n.º 2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request)
 {
     if ($request->name == "") {
         $injections = Defoult::where('name', 'no_found')->get();
         return view('injections.show', compact('injections'));
     } else {
         $injections = Injection::where('name', 'ILIKE', '%' . trim($request->get(trim('name'))) . '%')->get();
         if (sizeof($injections) == 0) {
             $injections = Defoult::where('name', 'no_found')->get();
             //dd($injections);
             return view('injections.show', compact('injections'));
         }
         $injections = Injection::where('name', 'ILIKE', '%' . trim($request->get(trim('name'))) . '%')->get();
         return view('injections.show1', compact('injections'));
     }
 }
Ejemplo n.º 3
0
 public function store(Request $request)
 {
     $rules = array('numeroAnimal' => 'required', 'nombre' => 'required', 'raza' => 'required', 'genero' => 'required', 'fechaNacimiento' => 'required', 'pesoNacimiento' => 'required|integer', 'observaciones' => 'required');
     $this->validate($request, $rules);
     $id_users = Auth::id();
     $animal = new Animal();
     $farm = \DB::table('farms')->first();
     //Validamos si padre o madre son desconocido y asignamos nombre
     if ($request->madre == null && $request->padre == null) {
         $animal->idMadre = "000";
         $animal->idPadre = "000";
     } elseif ($request->padre == null) {
         $animal->idPadre = "000";
         $animal->idMadre = $request->madre;
     } elseif ($request->madre == null) {
         $animal->idMadre = '000';
         $animal->idPadre = $request->padre;
     } else {
         $animal->idMadre = $request->madre;
         $animal->idPadre = $request->padre;
     }
     $animal->idUser = $id_users;
     $animal->numeroAnimal = $farm->name . '' . $request->numeroAnimal;
     $animal->nombre = $request->nombre;
     $animal->raza = $request->raza;
     $animal->genero = $request->genero;
     $animal->fechaNacimiento = $request->fechaNacimiento;
     $animal->pesoNacimiento = $request->pesoNacimiento;
     $animal->observaciones = $request->observaciones;
     //Validacion de imagen
     if (Input::hasFile('image')) {
         $file = Input::file('image');
         //Creamos una instancia de la libreria instalada
         $image = \Image::make(\Input::file('image'));
         //Ruta donde queremos guardar las imagenes
         $path = 'img/animal/';
         // Cambiar de tamaño
         $image->resize(450, 450);
         $image->save($path . $file->getClientOriginalName());
         $animal->image = $file->getClientOriginalName();
         $animal->save();
         return redirect()->route('animal.index');
     }
     //Si no hay imagen, se guarda una por defecto
     $image = 'animal';
     $default = Defoult::where('name', $image)->pluck('image');
     $animal->image = $default;
     //dd($farm->patent);
     $animal->save();
     return redirect()->route('animal.index');
 }
Ejemplo n.º 4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request)
 {
     if ($request->nameV == "") {
         $vaccines = Defoult::where('name', 'no_found')->get();
         //pluck('name');
         //$vaccines = Vaccine::where('name', '$default') -> get();
         //dd($vaccines);
         return view('vaccines.show', compact('vaccines'));
     } else {
         $vaccines = Vaccine::where('name', 'ILIKE', '%' . trim($request->get(trim('name'))) . '%')->get();
         if (sizeof($vaccines) == 0) {
             $vaccines = Defoult::where('name', 'no_found')->get();
             return view('vaccines.show', compact('vaccines'));
         }
         $vaccines = Vaccine::where('name', 'ILIKE', '%' . trim($request->get(trim('name'))) . '%')->get();
         return view('vaccines.show1', compact('vaccines'));
     }
 }
Ejemplo n.º 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $farm = Farm::findOrFail($id);
     $rules = array('name' => 'required', 'agent' => 'required', 'operationCertificate' => 'required', 'address' => 'required');
     $this->validate($request, $rules);
     $farm->latitude = "120";
     $farm->longitude = "120";
     $farm->name = $request->name;
     if (Input::hasFile('patent')) {
         $file = Input::file('patent');
         //Creamos una instancia de la libreria instalada
         $patent = \Image::make(\Input::file('patent'));
         //Ruta donde queremos guardar las imagenes
         $path = 'img/patent/';
         // Cambiar de tamaño
         $patent->resize(450, 450);
         $patent->save($path . $file->getClientOriginalName());
         $farm->patent = $file->getClientOriginalName();
         $farm->save();
         return redirect()->route('farm.index');
     }
     $patent = 'patent';
     $default = Defoult::where('name', $patent)->pluck('image');
     $farm->patent = $default;
     //dd($farm->patent);
     $farm->save();
     return redirect()->route('farm.index');
 }
 /**
  * Busca por nombre.
  *
  * @param  Request  $request
  * @return 
  */
 public function show(Request $request)
 {
     if ($request->nameProduct == "") {
         $food__supplements = Defoult::where('name', 'no_found')->get();
         return view('food__supplements.show', compact('food__supplements'));
     } else {
         $food__supplements = Food_Supplement::where('nameProduct', 'ILIKE', '%' . trim($request->get(trim('nameProduct'))) . '%')->get();
         if (sizeof($food__supplements) == 0) {
             $food__supplements = Defoult::where('name', 'no_found')->get();
             return view('food__supplements.show', compact('food__supplements'));
         }
         $food__supplements = Food_Supplement::where('nameProduct', 'ILIKE', '%' . trim($request->get(trim('nameProduct'))) . '%')->get();
         return view('food__supplements.show1', compact('food__supplements'));
     }
 }