diff options
author | Mateja <mail@matejamaric.com> | 2020-11-07 01:41:03 +0100 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2020-11-07 01:41:03 +0100 |
commit | 3ff7e365c4aedbc47d642a07181cae45269a329d (patch) | |
tree | 1a340a7b6271d1dc54b6c781ed5ca96d5f234b19 /app/Http/Controllers/GalleryController.php | |
parent | fe6e62f3de62cde07f696738146e15af9483d8e8 (diff) | |
download | yota-laravel-3ff7e365c4aedbc47d642a07181cae45269a329d.tar.gz yota-laravel-3ff7e365c4aedbc47d642a07181cae45269a329d.zip |
Better news. I should implement url()->previous();
Gallery doesn't delete from storage...
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.'); } } |