示例#1
0
 /**
  * 
  * @return a list of objects.
  */
 public static function listByFullName()
 {
     $items = TipoTorneoFase::all();
     $key = 'id';
     $value = 'full_name';
     return TipoTorneoFase::getListFields($items, $key, $value);
 }
示例#2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $torneo = Torneo::findOrFail($id);
     /*$torneo = Torneo::with('temporada')
       ->with('division.categoria.genero')
       ->with('fases.grupos.clubes.torneo_club.club')
       ->with('fechas.partidos.clubes.torneo_grupo_club.torneo_grupo.fase')
       ->with('fechas.partidos.clubes.torneo_grupo_club.torneo_club.club')
       ->with('clubes.jugadores')
       ->with('clubes.club')
       ->findOrFail($id);*/
     $this->webpage['whereAmI'] = $this->BreadcrumbRoot($torneo->temporada, $torneo);
     $this->webpage['whereAmI'] .= $this->listOneBreadcrumb('editar');
     $this->webpage['tab_title'] = $torneo->maximal_full_name . ' - Editar';
     $equipos = Club::with(['divisiones' => function ($q) use($torneo) {
         $q->where("division_id", $torneo->division);
     }])->get();
     $tipo_primera_fase = TipoTorneoFase::where('fase_numero', 1)->where('tipo_torneo_id', $torneo->tipo_torneo_id)->first();
     $torneo_clubes = TorneoClub::with(['club', 'torneo_grupos'])->whereHas('torneo_grupos', function ($q = '') {
         $q->whereHas('torneo_grupo', function ($subq) {
             $subq->where("fase_id", 1);
         });
     })->where("torneo_id", $torneo->id)->get();
     // OJO; DIF ENTRE EQUIPOS Y TORNEOS CLUBES, VERIFICAR
     $equipos = $equipos->diff($torneo_clubes->pluck('club'));
     // dd($equipos);
     /*$partidos = Partido::with('fecha')->whereHas('fecha',function ($q) use ($id) {
                     $q->where('torneo_id',$id);
                 })->whereIn('estado_id',[3,4,5,6])->get();
     
                 $torneo->comenzado = false;
                 if ($partidos->count()) {
                     $torneo->comenzado = true;
                 }*/
     $this->data = array_merge(['webpage' => $this->webpage, 'equipos' => $equipos, 'torneo_clubes' => $torneo_clubes, 'torneo' => $torneo, 'tipo_primera_fase' => $tipo_primera_fase], $this->data);
     return view('admin.seasons.torneos.edit', $this->data);
 }