diff options
Diffstat (limited to 'app/Http/Controllers/GalleryController.php')
-rw-r--r-- | app/Http/Controllers/GalleryController.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/Http/Controllers/GalleryController.php b/app/Http/Controllers/GalleryController.php index 064be02..d2a04c5 100644 --- a/app/Http/Controllers/GalleryController.php +++ b/app/Http/Controllers/GalleryController.php @@ -8,6 +8,7 @@ use dd; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Validator; +use Illuminate\Support\Facades\Storage; use App\Models\Image; @@ -102,7 +103,10 @@ class GalleryController extends Controller */ public function destroy($id) { - Image::findOrFail($id)->delete(); + $img = Image::findOrFail($id); + $path = $img->path . $img->name; + Storage::delete($path); + $img->delete(); return Redirect::back()->with('status', 'Image deleted.'); } } |