Esempio n. 1
0
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);
});
Route::get('/serie/{name}/{id}', function ($name, $id) {
    $cita = Cita::orderBy('created_at', 'desc')->first();
    $galeria = Galeria::find($id);
    if ($name == 'Videos') {
        $sql = "SELECT id, galeria_id, null as imagen, video, poster, null as audio, titulo, 'video' as tipo, descripcion, created_at FROM videos ORDER BY created_at desc";
    } else {
Esempio n. 2
0
 public function imagen()
 {
     return Imagen::find($this->imagen_id);
 }
Esempio n. 3
0
 public static function borrar($input)
 {
     $respuesta = array();
     $reglas = array('id' => array('integer'));
     $validator = Validator::make($input, $reglas);
     if ($validator->fails()) {
         $respuesta['mensaje'] = $validator;
         $respuesta['error'] = true;
     } else {
         $imagen = Imagen::find($input['id']);
         $imagen->fecha_baja = date("Y-m-d H:i:s");
         $imagen->estado = 'B';
         $imagen->usuario_id_baja = Auth::user()->id;
         $imagen->save();
         if ($imagen->ampliada != 0) {
             $datos = array('id' => $imagen->ampliada);
             $imagen = Imagen::borrar($datos);
         }
         $respuesta['mensaje'] = 'Imagen eliminada.';
         $respuesta['error'] = false;
         $respuesta['data'] = $imagen;
     }
     return $respuesta;
 }
Esempio n. 4
0
 public function imagen_destacada()
 {
     $img = NULL;
     foreach ($this->obtener_destacada() as $image) {
         $img = Imagen::find($image->id);
     }
     return $img;
 }