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();
 }
 public function reposition()
 {
     if (\Request::has('item')) {
         $i = 0;
         foreach (\Request::get('item') as $id) {
             $i++;
             $item = GalleryCategory::find($id);
             $item->position = $i;
             $item->save();
         }
         return \Response::json(array('success' => true));
     } else {
         return \Response::json(array('success' => false));
     }
 }
Пример #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();
 }
Пример #4
0
 public function filter($category_id)
 {
     $gallerySeries = GallerySerie::where('category_id', '=', $category_id)->orderBy('position')->get();
     $galleryCategories = GalleryCategory::lists('name', 'id');
     return view('gallery-series.index', compact('gallerySeries', 'galleryCategories', 'category_id'));
 }