aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-11-07 00:23:09 +0100
committerMateja <mail@matejamaric.com>2020-11-07 00:23:09 +0100
commit76cbb07c91ec5a868956c116d4fccc6e3cf8d487 (patch)
tree6fa9cbd66c5b7d0dc68eebe00bf29704f73bf137
parente4fec1b5386c19a7c0bfb28b850862159c8710dd (diff)
downloadyota-laravel-76cbb07c91ec5a868956c116d4fccc6e3cf8d487.tar.gz
yota-laravel-76cbb07c91ec5a868956c116d4fccc6e3cf8d487.zip
Fixed image add issue.
-rw-r--r--app/Http/Controllers/GalleryController.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/Http/Controllers/GalleryController.php b/app/Http/Controllers/GalleryController.php
index 3f11997..db0f956 100644
--- a/app/Http/Controllers/GalleryController.php
+++ b/app/Http/Controllers/GalleryController.php
@@ -46,12 +46,13 @@ class GalleryController extends Controller
]);
$images = $request->file('images');
foreach ($images as $image) {
- $save = new Image();
- $save->path = 'imgs/';
- $save->name = time() . '.' . $image->getClientOriginalExtension();
-
- $image->storeAs($save->path, $save->name);
+ $path = 'imgs/';
+ $name = time() . '.' . $image->getClientOriginalExtension();
+ $image->move($path, $name);
+ $save = new Image();
+ $save->path = $path;
+ $save->name = $name;
$save->save();
}