Пример #1
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');
 }
Пример #2
0
 public function getIniciadoAttribute()
 {
     $iniciado = false;
     $fechas = TorneoFecha::with('partidos')->where('torneo_id', $this->id)->get();
     foreach ($fechas as $fecha) {
         foreach ($fecha->partidos as $partido) {
             if ($partido->estado_id == 4) {
                 return true;
             }
         }
     }
     return $iniciado;
 }