Beispiel #1
0
 public function buscar($id)
 {
     // en este método podemos observar como se recibe un parámetro llamado id
     // este es el id del usuario que se desea buscar y se debe declarar en la ruta como un parámetro
     $arbitro = Arbitro::find($id);
     // para buscar al usuario utilizamos el metido find que nos proporciona Laravel
     // este método devuelve un objete con toda la información que contiene un usuario
     return View::make('arbitros.busca', array('arbitros' => $arbitro));
 }
Beispiel #2
0
 public static function editar($dni, $input)
 {
     $respuesta = [];
     $reglas = ['dni' => array('required', 'min:8', 'max:8'), 'nombre' => array('required'), 'apellidos' => array('required'), 'edad' => array('required')];
     $validador = Validator::make($input, $reglas);
     if ($validador->fails()) {
         $respuesta['mensaje'] = $validador;
         $respuesta['error'] = true;
     } else {
         Arbitro::where('dni', '=', $dni)->update(['' => '']);
         $respuesta['mensaje'] = 'Datos no Actualizados';
         $respuesta['error'] = true;
     }
     return $respuesta;
 }
 public function mostrarArbitros()
 {
     $arbitros = Arbitro::all();
     // Con el método all() le estamos pidiendo al modelo de Usuario
     // que busque todos los registros contenidos en esa tabla y los devuelva en un Array
     return View::make('arbitros.lista', array('arbitros' => $arbitros));
     // El método make de la clase View indica cual vista vamos a mostrar al usuario
     //y también pasa como parámetro los datos que queramos pasar a la vista.
     // En este caso le estamos pasando un array con todos los usuarios
 }
Beispiel #4
0
 public function partido($codcampeonato, $codrueda, $idfecha, $codpartido)
 {
     //$todoConclusion = Cambio::all();
     //elementos
     $fecha = Fechas::find($idfecha);
     $partido = Partido::find($codpartido);
     $programacion = Programacion::find($partido->codProgramacion);
     $torneo = Torneo::where('codRueda', '=', $codrueda)->first();
     $arbitros = Arbitro::all();
     $arbixPart = ArbitroPorPartido::where('codPartido', '=', $codpartido)->count();
     $todosArbitros = ArbitroPorPartido::where('codPartido', '=', $codpartido)->get();
     //end elementos
     $nroPartido = $programacion->nroPartido;
     $fixture = Fixture::where('codRueda', '=', $torneo->codRueda)->where('nroFecha', '=', $fecha->nroFecha)->where('nroPartido', '=', $nroPartido)->first();
     //elementos
     $equipo1 = Equipo::find($fixture->codEquipo1);
     $equipo2 = Equipo::find($fixture->codEquipo2);
     $activarPlanilla = Planilla::where('codPartido', '=', $codpartido)->first();
     $fechaactual = DB::select("select curdate() as fecha");
     $fechasiguiente = DB::select("select  adddate(curdate(),1) as fecha");
     $fechaAnterior = DB::select("select  subdate(curdate(),1) as fecha");
     $hora = DB::select("select  curtime() as hora");
     $horaAsistencia = DB::select("select  subtime(?,3000) as fecha", array($partido->horaInicio));
     foreach ($fechaactual as $value) {
         $Factual = $value->fecha;
     }
     foreach ($fechasiguiente as $value) {
         $Fsiguiente = $value->fecha;
     }
     foreach ($hora as $value) {
         $horaA = $value->hora;
     }
     foreach ($fechaAnterior as $value) {
         $Fantes = $value->fecha;
     }
     foreach ($horaAsistencia as $value) {
         $HrAistencia = $value->fecha;
     }
     ///===== es la dia de programacion
     $HH = DB::select("select  if(?=?,1,0) as fecha", array($fecha->diaFecha, $Factual));
     foreach ($HH as $value) {
         $esdiaProgramacion = $value->fecha;
     }
     //end fechaf
     // mañena es dia de programacion
     $HH = DB::select("select  if(?<?,1,0) as fecha", array($fecha->diaFecha, $Fsiguiente));
     foreach ($HH as $value) {
         $manenaProgramacion = $value->fecha;
     }
     // ayer fue dia de programacion
     $HH = DB::select("select  if(?=?,1,0) as fecha", array($fecha->diaFecha, $Fantes));
     foreach ($HH as $value) {
         $ayerFProgramacion = $value->fecha;
     }
     // si la  hora es mayor 23:50
     $HH = DB::select("select  if(?=?,1,0) as fecha", array(substr($horaA, 0, 5), "23:50"));
     foreach ($HH as $value) {
         $esHora = $value->fecha;
     }
     // es hora de inicio
     $HH = DB::select("select  if(curtime()>=? and curtime()<?,1,0) as fecha", array($partido->horaInicio, "23:50:00"));
     foreach ($HH as $value) {
         $HoraI = $value->fecha;
     }
     //hora de tomo asistencia 30 min
     $HH = DB::select("select  if(curtime()>=? and curtime()<=?,1,0) as fecha", array($HrAistencia, $partido->horaInicio));
     foreach ($HH as $value) {
         $AH = $value->fecha;
     }
     $jugadoresequipo1 = "";
     $jugadoresequipo2 = "";
     $activarPlanilla = Planilla::where('codPartido', '=', $codpartido)->first();
     if ($activarPlanilla != "") {
         $Planilla1 = Planilla::where('codPartido', '=', $codpartido)->where('nroPlantilla', '=', 1)->first();
         $Planilla2 = Planilla::where('codPartido', '=', $codpartido)->where('nroPlantilla', '=', 2)->first();
         //$fixture->codEquipo1
         //$Jequipo1 = Jugador::where('codequipo', '=', $fixture->equipo1)->get();
         //$Jequipo2 = Jugador::where('codequipo', '=', $fixture->equipo2)->get();
         //$arbitros = Arbitro::all();
         //todos los jugadores de este partido  $torneo $idtorneo,$idfecha,$idfixture)
     }
     /*
          $Delanteros1 = '';
          $Mediocampistas1 = '';
          $Defensas1 = '';
          $Guardameta1 = '';
          $suplentes1 = '';
          $jugadoresdeunpartido2 = '';
          //recuperamos los arbitros del partido
          $arbitrosdelpartido = '';
          //verificamos si el partido ya se jugó
              //recuperar los datos del partido jugado
              $arbitrosdelpartido = ArbitroPorPartido::where('codPartido','=',$partido->codPartido)->first();
     
              //resuperamos todos los jugadores de este partido  ... un rato
     /*
              $Delanteros1 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
                  ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo1)
                  ->where('tjugadorenjuego.condicionenpartido','=','delantero')
                  ->get();
              $Mediocampistas1 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
                  ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo1)
                  ->where('tjugadorenjuego.condicionenpartido','=','mediocampista')
                  ->get();
              $Defensas1 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
                  ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo1)
                  ->where('tjugadorenjuego.condicionenpartido','=','defensa')
                  ->get();
              $Guardameta1 = DB::table('tjugadorenjuego')
              ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
              ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
              ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
              ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
              ->where('tjugador.codequipo','=',$fixture->equipo1)
              ->where('tjugadorenjuego.condicionenpartido','=','guardameta')
              ->get();
              $suplentes1 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
                  ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo1)
                  ->where('tjugadorenjuego.condicionenpartido','=','suplente')
                  ->get();
              $jugadoresdeunpartido2 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo2)
                  ->get();
     */
     $activarPlanilla = Planilla::where('codPartido', '=', $codpartido)->first();
     return View::make('user_com_organizing.fecha.partido.index', compact('fixture'))->with('idfecha', $idfecha)->with('torneo', $torneo)->with('programacion', $programacion)->with('codcampeonato', $codcampeonato)->with('arbitros', $arbitros)->with('partido', $partido)->with('arbixPart', $arbixPart)->with('todosArbitros', $todosArbitros)->with('equipo1', $equipo1)->with('equipo2', $equipo2)->with('activarPlanilla', $activarPlanilla)->with('esdiaProgramacion', $esdiaProgramacion)->with('manenaProgramacion', $manenaProgramacion)->with('ayerFProgramacion', $ayerFProgramacion)->with('esHora', $esHora)->with('HoraI', $HoraI)->with('AH', $AH);
     //->with('todoConclusion', $todoConclusion);
 }
Beispiel #5
0
 public function eliminar($dni)
 {
     Arbitro::find($dni)->delete();
     $error = ['wilson' => 'Arbitro eliminado correctamente'];
     return Redirect::back()->withInput()->withErrors($error);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $todoarbitros = Arbitro::all();
     return View::make('arbitro.ver')->with('todoarbitros', $todoarbitros);
 }