From 7d11a6fa1c2b523cf4499346be38fa052ea796b5 Mon Sep 17 00:00:00 2001 From: Torsten Date: Fri, 6 Oct 2023 16:25:38 +0200 Subject: [PATCH] Working on multiple files upload --- .../Http/Controllers/GalleryController.php | 40 ++++++++----------- motorradig/docker-compose/nginx/default.conf | 1 + .../views/tour/gallery/show.blade.php | 9 ++--- motorradig/routes/web.php | 3 +- 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/motorradig/app/Http/Controllers/GalleryController.php b/motorradig/app/Http/Controllers/GalleryController.php index 6dfb407..617d740 100644 --- a/motorradig/app/Http/Controllers/GalleryController.php +++ b/motorradig/app/Http/Controllers/GalleryController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use App\Gallery; use Illuminate\Http\Request; use Auth; +use App\Tour; class GalleryController extends Controller { @@ -24,16 +25,6 @@ class GalleryController extends Controller // } - /** - * Store a newly created resource in storage. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function store(Request $request) - { - // - } /** * Display the specified resource. @@ -45,7 +36,7 @@ class GalleryController extends Controller { //dd("role:" . Auth::user()->role . " id:" . \Auth::id() . " has_tour:" . Auth::user()->has_tour($tour_id, \Auth::id())); if(Auth::user()->role=="ADMIN" or Auth::user()->has_tour($tour_id, \Auth::id()) ) { - return view('tour/gallery/show'); + return view('tour/gallery/show')->with("tour_id",$tour_id); } @@ -63,19 +54,7 @@ class GalleryController extends Controller // } - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param \App\Gallery $gallery - * @return \Illuminate\Http\Response - */ - public function update(Request $request, $tour_id) - { - // - } - - /** + /** * Remove the specified resource from storage. * * @param \App\Gallery $gallery @@ -85,4 +64,17 @@ class GalleryController extends Controller { // } + + public function store(Request $request, Tour $tour) { + $request->validate( + [ + 'files' => 'required' + ] + ); + //$filelist = join(', ', $request->files); + //dd($filelist); + $filelist=""; + //foreach($request->files as $filename) { $filelist = $filelist + $filename; } + dd($request->files); + } } diff --git a/motorradig/docker-compose/nginx/default.conf b/motorradig/docker-compose/nginx/default.conf index dbd65ac..6198c3e 100644 --- a/motorradig/docker-compose/nginx/default.conf +++ b/motorradig/docker-compose/nginx/default.conf @@ -4,6 +4,7 @@ server { error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /var/www/public; + client_max_body_size 0; location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; diff --git a/motorradig/resources/views/tour/gallery/show.blade.php b/motorradig/resources/views/tour/gallery/show.blade.php index 272951e..ed6bcac 100644 --- a/motorradig/resources/views/tour/gallery/show.blade.php +++ b/motorradig/resources/views/tour/gallery/show.blade.php @@ -11,12 +11,11 @@ - - +

Hochladen

- -
- + + @csrf +
diff --git a/motorradig/routes/web.php b/motorradig/routes/web.php index f43303b..d816056 100644 --- a/motorradig/routes/web.php +++ b/motorradig/routes/web.php @@ -64,7 +64,8 @@ Route::get('/img_storage/{category}/{imageName}', 'ImageController@getImage'); // no middleware auth needed, its checked in Controller Route::get('/tour/gallery/{gallery_id}', 'GalleryController@show'); // no middleware auth needed, its checked in Controller - + Route::post('/tour/gallery/{gallery_id}', 'GalleryController@store'); + Auth::routes(); /* Cache clearing on remote server */