public function showPartidosFecha($fecha)
 {
     $partidos = Partido::with('equipoLocal', 'equipoVisitante', 'estadio')->where('fec_id', $fecha)->orderBy('par_goles_local', 'desc')->get();
     return $partidos->toJson();
 }
Ejemplo n.º 2
0
 /**
  * Genera el torneo y los partidos para imprimir el fixture de la fecha.
  *
  * @param  int  $fecha_id el id de la fecha
  * @return \Illuminate\Http\Response
  */
 public function fecha_partidos_pdf(Request $request)
 {
     $fecha_id = $request->get('fecha_id');
     $fecha = TorneoFecha::with('torneo')->findOrFail($fecha_id);
     $partidos = Partido::with('fecha')->with('estadio')->where('fecha_id', $fecha_id)->get();
     $this->data = array_merge(['torneo' => $fecha->torneo, 'partidos' => $partidos, 'fecha' => $fecha->orden]);
     $pdf = \PDF::loadView('admin.pdf.fecha', $this->data);
     return $pdf->stream('goleadores.pdf');
 }
Ejemplo n.º 3
0
 public function getFinalizadoAttribute()
 {
     $comenzado = false;
     $torneo_id = $this->id;
     // Estados Partidos
     // 1 : Sin Programar
     // 2 : Programado
     // 3 : Comenzado
     // 4 : Finalizado
     // 5 : Suspendido
     // 6 : Postergado
     $partidos = Partido::with('fecha')->whereHas('fecha', function ($q) use($torneo_id) {
         $q->where('torneo_id', $torneo_id);
     })->where('estado_id', '!=', Partido::FINALIZADO)->get();
     if ($partidos->count()) {
         $comenzado = true;
     }
     return $comenzado;
 }