diff options
| author | Mateja <mail@matejamaric.com> | 2020-11-07 00:23:09 +0100 | 
|---|---|---|
| committer | Mateja <mail@matejamaric.com> | 2020-11-07 00:23:09 +0100 | 
| commit | 76cbb07c91ec5a868956c116d4fccc6e3cf8d487 (patch) | |
| tree | 6fa9cbd66c5b7d0dc68eebe00bf29704f73bf137 /app/Http/Controllers/GalleryController.php | |
| parent | e4fec1b5386c19a7c0bfb28b850862159c8710dd (diff) | |
| download | yota-laravel-76cbb07c91ec5a868956c116d4fccc6e3cf8d487.tar.gz yota-laravel-76cbb07c91ec5a868956c116d4fccc6e3cf8d487.zip  | |
Fixed image add issue.
Diffstat (limited to 'app/Http/Controllers/GalleryController.php')
| -rw-r--r-- | app/Http/Controllers/GalleryController.php | 11 | 
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();          }  | 
