Ejemplo n.º 1
0
 public function MuestraWod($programa_id = 0)
 {
     date_default_timezone_set('America/Santiago');
     setlocale(LC_ALL, "es_ES");
     $programas = Programas::lists('nombre', 'id');
     $fecha = str_replace('-', '/', Input::get('fecha_wod', date('d/m/Y')));
     $programa = '';
     $fecha_where = new \DateTime(str_replace('/', '-', $fecha));
     if ($programa_id != 0) {
         $programa = Programas::find($programa_id)->nombre;
         $wod = Wods::with('secciones')->where('programa_id', $programa_id)->where('fecha', $fecha_where->format('Y-m-d'))->first();
     } else {
         $programa = Programas::first()->nombre;
         $wod = Wods::with('secciones')->where('programa_id', Programas::first()->id)->where('fecha', $fecha_where->format('Y-m-d'))->first();
         $programa_id = Programas::first()->id;
     }
     return view('app_alumnos/wods/wod', compact('programas', 'programa', 'programa_id', 'fecha', 'wod'));
 }