public function galeria() { return Galeria::where('item_id', $this->id)->first(); }
} else { $sql = "\n\n SELECT id, galeria_id, imagen, null as video, null as poster, null as audio, titulo, 'imagen' as tipo, descripcion, created_at FROM imagenes WHERE galeria_id = {$id} \n UNION \n SELECT id, galeria_id, null as imagen, video, poster, null as audio, titulo, 'video' as tipo, descripcion, created_at FROM videos WHERE galeria_id = {$id} \n UNION \n SELECT id, galeria_id, null as imagen, null as video, null as poster, audio, titulo, 'audio' as tipo, descripcion, created_at FROM audios WHERE galeria_id = {$id} ORDER BY created_at desc"; } $items = DB::select($sql); $subgalerias = "SELECT * FROM subcategorias WHERE galeria_id = " . $id; $subgalerias = DB::select($subgalerias); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('serie', array('cita' => $cita, 'imagenes' => $items, 'galeria' => $galeria, 'menu' => $menu, 'subgalerias' => $subgalerias)); }); Route::get('/sub/{id}', function ($id) { $cita = Cita::orderBy('created_at', 'desc')->first(); $subGaleria = SubGaleria::find($id); $sql = "\n\n SELECT id, galeria_id, imagen, null as video, null as poster, null as audio, titulo, 'imagen' as tipo, created_at FROM imagenes WHERE subcategoria_id = {$id} \n UNION \n SELECT id, galeria_id, null as imagen, video, poster, null as audio, titulo, 'video' as tipo, created_at FROM videos WHERE subcategoria_id = {$id} \n UNION \n SELECT id, galeria_id, null as imagen, null as video, null as poster, audio, titulo, 'audio' as tipo, created_at FROM audios WHERE subcategoria_id = {$id} ORDER BY created_at desc"; $items = DB::select($sql); $galeria = Galeria::find($subGaleria->galeria_id); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('serie', array('cita' => $cita, 'imagenes' => $items, 'galeria' => $galeria, 'subGaleria' => $subGaleria, 'menu' => $menu)); }); Route::get('user/login', function () { return View::make('login'); }); Route::get('user/logout', function () { Sentry::logout(); return View::make('login'); }); Route::post('user/login', function () { // Set login credentials $credentials = array('email' => Input::get('email'), 'password' => Input::get('password')); $remember = Input::get('remember') ? true : false; // Try to authenticate the user $user = Sentry::authenticate($credentials, $remember);
public static function buscar($item_id) { return Galeria::where('item_id', $item_id)->first(); }