From 76cbb07c91ec5a868956c116d4fccc6e3cf8d487 Mon Sep 17 00:00:00 2001 From: Mateja Date: Sat, 7 Nov 2020 00:23:09 +0100 Subject: Fixed image add issue. --- app/Http/Controllers/GalleryController.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'app') 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(); } -- cgit v1.2.3