public function destroy($id)
 {
     $category = GalleryCategory::where('id', '=', $id)->firstOrFail();
     $path = public_path() . config('gallery.path') . $category->slug;
     $this->removeDirectory($path);
     $this->getById($id)->delete();
 }
예제 #2
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();
 }