/**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $parent_rules = parent::rules();
     $estadio = Estadio::findOrFail($this->route->getParameter('estadios'));
     $my_rules = array('nombre' => ['required', 'min:3', 'unique:estadios,nombre,' . $estadio->id]);
     $rules = array_merge($parent_rules, $my_rules);
     return $rules;
 }
 public function consulta(Request $request)
 {
     $keyword = $request->get('nombre');
     if (trim(urldecode($keyword)) == '') {
         return response()->json(['data' => []], 200);
     }
     $resultados = Estadio::where('est_nombre', 'LIKE', '%' . $keyword . '%')->orderBy('est_nombre')->take(3)->get(['est_id', 'est_nombre']);
     return response()->json(['data' => $resultados]);
 }
Example #3
0
 public function search()
 {
     //DB::enableQueryLog();
     $search_text = Input::get("text");
     $estadio = Estadio::with(['domicilio', 'club'])->where("nombre", 'LIKE', '%' . $search_text . '%')->first();
     $result = null;
     return response()->json(['result' => 'Ok', 'response' => $result]);
 }
Example #4
0
 public function obtenerEstadio()
 {
     $estadios = Estadio::orderBy('estadio', 'DESC')->paginate(100);
     return view('usuario.actividades.actividadesestadio')->with('estadios', $estadios);
 }
Example #5
0
 public function delete($id)
 {
     $affectedRows = Estadio::where('estadio', '=', $id)->delete();
     return view('admin.admin');
 }
Example #6
0
 /**
  * 
  * @return a list of objects.
  */
 public static function listByFullName($estadio_id = '')
 {
     if ($estadio_id != '') {
         $items = Estadio::where('id', $estadio_id)->get();
     } else {
         $items = Estadio::all();
     }
     $key = 'id';
     $value = 'full_name';
     return Estadio::getListFields($items, $key, $value);
 }
Example #7
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function updateDefinition(UpdatePartidoDefinirRequest $request, $id)
 {
     DB::transaction(function () use($request, $id) {
         $estadio_id = $request->get('estadio_id');
         $dia = $request->get('dia_partido');
         $hora = $request->get('hora_partido');
         if ($dia == '') {
             $hora = '';
         }
         // o pongo las dos, o no pongo ninguna
         if ($hora == '') {
             $dia = '';
         }
         // o pongo las dos, o no pongo ninguna
         $partido = Partido::findOrFail($id);
         $partido->estadio_id = null;
         $estadio = Estadio::where('id', $estadio_id)->first();
         if ($estadio) {
             $partido->estadio_id = $estadio->id;
         }
         $estado_id = $partido->estado_id;
         if ($estado_id == 1 || $estado_id == 2) {
             $estado_id = 1;
             if ($dia != '') {
                 $estado_id = 2;
             }
         }
         $partido->dia_partido = $dia;
         $partido->hora_partido = $hora;
         $partido->estado_id = $estado_id;
         $partido->save();
         $this->updateDefinitionVeedor($id, $request);
         $this->updateDefinitionArbitros($id, $request);
     });
     return \Redirect::route('seasons.partidos.show', $id);
 }