aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-11-07 00:10:15 +0100
committerMateja <mail@matejamaric.com>2020-11-07 00:10:15 +0100
commite4fec1b5386c19a7c0bfb28b850862159c8710dd (patch)
tree21b6d41bda84fc85aaab996bdc2bf1bdb76d1cca /app
parent7907c1eecc37e5378da0e28838203c70c693ec71 (diff)
downloadyota-laravel-e4fec1b5386c19a7c0bfb28b850862159c8710dd.tar.gz
yota-laravel-e4fec1b5386c19a7c0bfb28b850862159c8710dd.zip
Work on gallery...
Diffstat (limited to 'app')
-rw-r--r--app/Http/Controllers/GalleryController.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/app/Http/Controllers/GalleryController.php b/app/Http/Controllers/GalleryController.php
index 8f42b48..3f11997 100644
--- a/app/Http/Controllers/GalleryController.php
+++ b/app/Http/Controllers/GalleryController.php
@@ -4,6 +4,13 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
+use dd;
+
+use Illuminate\Support\Facades\Redirect;
+use Illuminate\Support\Facades\Validator;
+
+use App\Models\Image;
+
class GalleryController extends Controller
{
/**
@@ -34,7 +41,21 @@ class GalleryController extends Controller
*/
public function store(Request $request)
{
- //
+ $validatedData = $request->validate([
+ 'images' => 'required'
+ ]);
+ $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);
+
+ $save->save();
+ }
+
+ return Redirect::back();
}
/**
@@ -79,6 +100,6 @@ class GalleryController extends Controller
*/
public function destroy($id)
{
- //
+ return Redirect::back();
}
}