Ejemplo n.º 1
0
 public function destroy($id)
 {
     $serie = GallerySerie::with('category')->where('id', '=', $id)->firstOrFail();
     $path = public_path() . config('gallery.path') . $serie->category->slug . '/' . $serie->slug;
     $this->removeDirectory($path);
     $this->getById($id)->delete();
 }
Ejemplo n.º 2
0
 public function reposition()
 {
     if (\Request::has('item')) {
         $i = 0;
         foreach (\Request::get('item') as $id) {
             $i++;
             $item = GallerySerie::find($id);
             $item->position = $i;
             $item->save();
         }
         return \Response::json(array('success' => true));
     } else {
         return \Response::json(array('success' => false));
     }
 }
Ejemplo n.º 3
0
 public function destroy($id)
 {
     $image = $this->getById($id);
     $gallerySerie = GallerySerie::where('id', '=', $image->serie_id)->firstOrFail();
     $galleryCategory = GalleryCategory::where('id', '=', $gallerySerie['category_id'])->firstOrFail();
     $path = public_path() . config('gallery.path') . $galleryCategory['slug'] . '/' . $gallerySerie['slug'];
     $file = $path . '/' . $id . '.' . $image->extension;
     $thumb = $path . '/' . $id . '_thumb.' . $image->extension;
     if (is_file($file)) {
         unlink($file);
     }
     if (is_file($thumb)) {
         unlink($thumb);
     }
     $this->getById($id)->delete();
 }
Ejemplo n.º 4
0
 public function filter($gallerySerie_id)
 {
     $galleryImages = GalleryImage::where('serie_id', '=', $gallerySerie_id)->orderBy('position')->get();
     $gallerySerie = GallerySerie::where('id', '=', $gallerySerie_id)->firstOrFail();
     return view('gallery.images.index', compact('galleryImages', 'gallerySerie', 'gallerySerie_id'));
 }