aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-11-07 13:28:13 +0100
committerMateja <mail@matejamaric.com>2020-11-07 13:28:13 +0100
commitb74cd28337d9774e37e0dbc8e541ea9026c6d7f7 (patch)
tree56b1e90069e1a1d37bda8e2697252c3dfca7a02a
parent5bdda7444013a0f9d87831daf29760a42ea29ee8 (diff)
downloadyota-laravel-b74cd28337d9774e37e0dbc8e541ea9026c6d7f7.tar.gz
yota-laravel-b74cd28337d9774e37e0dbc8e541ea9026c6d7f7.zip
Fixed gallery delete...
-rw-r--r--app/Http/Controllers/GalleryController.php4
-rw-r--r--public/imgs/camp.pngbin610511 -> 0 bytes
-rw-r--r--public/imgs/yota.jpgbin73473 -> 0 bytes
-rw-r--r--resources/views/pages/gallery.blade.php2
4 files changed, 3 insertions, 3 deletions
diff --git a/app/Http/Controllers/GalleryController.php b/app/Http/Controllers/GalleryController.php
index d2a04c5..8022ea0 100644
--- a/app/Http/Controllers/GalleryController.php
+++ b/app/Http/Controllers/GalleryController.php
@@ -50,7 +50,7 @@ class GalleryController extends Controller
foreach ($images as $image) {
$path = 'imgs/';
$name = time() . '.' . uniqid() . '.' . $image->getClientOriginalExtension();
- $image->move($path, $name);
+ $image->storeAs($path, $name, 'public');
$save = new Image();
$save->path = $path;
@@ -105,8 +105,8 @@ class GalleryController extends Controller
{
$img = Image::findOrFail($id);
$path = $img->path . $img->name;
- Storage::delete($path);
$img->delete();
+ Storage::disk('public')->delete($path);
return Redirect::back()->with('status', 'Image deleted.');
}
}
diff --git a/public/imgs/camp.png b/public/imgs/camp.png
deleted file mode 100644
index ddf7f9d..0000000
--- a/public/imgs/camp.png
+++ /dev/null
Binary files differ
diff --git a/public/imgs/yota.jpg b/public/imgs/yota.jpg
deleted file mode 100644
index 2aca0b7..0000000
--- a/public/imgs/yota.jpg
+++ /dev/null
Binary files differ
diff --git a/resources/views/pages/gallery.blade.php b/resources/views/pages/gallery.blade.php
index 502cb63..cd64b52 100644
--- a/resources/views/pages/gallery.blade.php
+++ b/resources/views/pages/gallery.blade.php
@@ -18,7 +18,7 @@
<div class="col-lg-6">
<div class="card mb-3">
<div class="card-img-top">
- <img class="img-fluid" src="{{ asset($image->path . $image->name) }}" alt="{{ $image->name }}" loading="lazy">
+ <img class="img-fluid" src="{{ asset('storage/' . $image->path . $image->name) }}" alt="{{ $image->name }}" loading="lazy">
</div>
@auth
<div class="card-body">