/** * Show the application dashboard to the user. * * @return Response */ public function index() { $banners = Banner::where('active', 'Y')->orderBy('id', 'desc')->get(); $news = News::orderBy('date', 'desc')->take(5)->get(); $videos = Video::orderBy('id', 'desc')->take(5)->get(); return view('home', compact('banners', 'news', 'videos')); }
/** * Display the specified resource. * * @return Response */ public function show() { $videos = Video::orderBy('id', 'asc')->get(); return view('video', compact('videos')); /* $functionalities = Functionality::all(); return view('functionalities', compact('functionalities'));*/ }
/** * Get paginated videos * * @param int $page Number of videos per page * @param int $limit Results per page * @param boolean $all Show published or all * @return StdClass Object with $items and $totalItems for pagination */ public function paginate($page = 1, $limit = 10, $all = false, $notLazy = false) { $result = new \StdClass(); $result->page = $page; $result->limit = $limit; $result->totalItems = 0; $result->items = array(); $query = $this->video->orderBy('created_at', 'DESC')->where('lang', $this->getLang()); $videos = $query->skip($limit * ($page - 1))->take($limit)->get(); $result->totalItems = $this->totalVideos(); $result->items = $videos->all(); if (!$notLazy) { // set video details foreach ($result->items as $k => $v) { $v->setDetailsAttribute($this->getDetails($v['attributes']['type'], $v['attributes']['video_id'])); } } return $result; }
/** * Display a listing of videos * * @return Response */ public function index() { $search_value = Input::get('s'); if (!empty($search_value)) { $videos = Video::where('title', 'LIKE', '%' . $search_value . '%')->orderBy('created_at', 'desc')->paginate(9); } else { $videos = Video::orderBy('created_at', 'DESC')->paginate(9); } $user = Auth::user(); $data = array('videos' => $videos, 'user' => $user, 'admin_user' => Auth::user()); return View::make('admin.videos.index', $data); }
return Redirect::to("/?s=1"); }); Route::get('contacto', function () { $cita = Cita::orderBy('created_at', 'desc')->first(); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('contacto', array('cita' => $cita, 'menu' => $menu)); }); Route::get('bio', function () { $cita = Cita::orderBy('created_at', 'desc')->first(); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('bio', array('cita' => $cita, 'menu' => $menu, 'bio' => DB::table('bio')->orderBy('id', 'desc')->first())); }); Route::get('/', function () { $cita = Cita::orderBy('created_at', 'desc')->first(); $galerias = Galeria::with('imagenes')->where('estado', '=', 'Activa')->orderBy('order')->get(); $video = Video::orderBy('id')->first(); $audio = Audio::orderBy('id')->first(); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('index', array('cita' => $cita, 'galerias' => $galerias, 'menu' => $menu, 'audio' => $audio, 'video' => $video)); }); Route::get('/imagen/{name}/{id}', function ($name, $id) { $cita = Cita::orderBy('created_at', 'desc')->first(); $imagen = Imagen::find($id); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('imagen', array('cita' => $cita, 'imagen' => $imagen, 'menu' => $menu)); }); Route::get('/video/{name}/{id}', function ($name, $id) { $cita = Cita::orderBy('created_at', 'desc')->first(); $video = Video::find($id); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return Redirect::to($video->video);