public function mostrarEventos()
 {
     //$Posts = DB::table('blog')->orderBy('id','desc')->paginate(2);
     //$bannersizquierda = DB::table('banners')->where('seccion', '=', 'BLOG-IZQUIERDA','AND')->where('habilitar', '=', '1')->orderBy('id','asc')->get();
     $bannersizquierda = Banner::where('seccion', '=', 'EVENTOS-IZQUIERDA')->where('habilitar', '=', '1')->orderBy('id', 'asc')->get();
     $bannersderecha = Banner::where('seccion', '=', 'EVENTOS-DERECHA')->where('habilitar', '=', '1')->orderBy('id', 'asc')->get();
     $bannersindexarriba = Banner::where('seccion', '=', 'INDEX-ARRIBA')->where('habilitar', '=', 1)->orderBy('id', 'asc')->get();
     $eventos = Evento::orderBy('fecha', 'desc')->paginate(5);
     $anuncios = Anuncio::all();
     $rolusuarioLogueado = '';
     $mailusuarioLogueado = '';
     $nombreusuarioLogueado = '';
     if (Auth::check()) {
         $authuser = Auth::user();
         $usu = Usuario::find($authuser->id);
         $mailusuarioLogueado = $authuser->email;
         $nombreusuarioLogueado = $authuser->nombre;
         $rolusuarioLogueado = DB::table('usuario_tiene_rol2')->where('usuario_id', '=', $authuser->id)->first();
         $rolusuarioLogueado = UsuarioRol::find($rolusuarioLogueado->rol_id)->rol;
     }
     return View::make('index.eventos')->with(array('bannersizquierda' => $bannersizquierda, 'bannersderecha' => $bannersderecha, 'eventos' => $eventos, 'anuncios' => $anuncios, 'username' => $mailusuarioLogueado, 'nameuser' => $nombreusuarioLogueado, 'roluser' => $rolusuarioLogueado, 'bannersindexarriba' => $bannersindexarriba));
     //
 }
Пример #2
0
 public function index()
 {
     $eventos = Evento::orderBy('data_evento', 'asc')->take(2)->get();
     $prox_evento = Evento::orderBy('data_evento', 'asc')->take(1)->where('cronograma', '=', 1)->get();
     return View::make('index', array('eventos' => $eventos, 'prox_evento' => $prox_evento));
 }