From 9526e2f7440a7ab81f20e8038e298e46c3080a67 Mon Sep 17 00:00:00 2001 From: tschneider Date: Mon, 30 Nov 2020 11:01:05 +0100 Subject: [PATCH] Fixed TourBearbeiten, fixed Cancelled Checkbox in tour.show and tour.edit --- motorradig/app/Http/Controllers/TourController.php | 8 ++++++-- motorradig/resources/views/tour/edit.blade.php | 10 +++++++--- motorradig/resources/views/tour/show.blade.php | 9 +++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/motorradig/app/Http/Controllers/TourController.php b/motorradig/app/Http/Controllers/TourController.php index 9147958..247c5b5 100644 --- a/motorradig/app/Http/Controllers/TourController.php +++ b/motorradig/app/Http/Controllers/TourController.php @@ -151,6 +151,7 @@ class TourController extends Controller */ public function update(Request $request, Tour $tour) { + error_log("Tour:update"); $tour=Tour::find($request->input('tour_id')); @@ -185,14 +186,17 @@ class TourController extends Controller } $tour->name=$request->input('name'); - if ($request->beschreibung) $request->input('beschreibung'); + if ($request->beschreibung) $tour->beschreibung=$request->input('beschreibung'); if ($request->start) $tour->start=$request->input('start'); if ($request->deadline) $tour->deadline=$request->input('deadline'); if ($request->max_participants) $tour->max_participants=$request->input('max_participants'); - if ($request->is_cancelled) $tour->is_cancelled=$request->input('is_cancelled',false); + $tour->is_cancelled= ($request->has('is_cancelled')); if ($request->bericht) $tour->bericht=$request->bericht; $tour->save(); + + error_log("Is cancelled:". $tour->is_cancelled); + return redirect('/tour'); } diff --git a/motorradig/resources/views/tour/edit.blade.php b/motorradig/resources/views/tour/edit.blade.php index f8e7aa5..14f1509 100644 --- a/motorradig/resources/views/tour/edit.blade.php +++ b/motorradig/resources/views/tour/edit.blade.php @@ -54,10 +54,14 @@ - @if($tour->) +
- - + + is_cancelled) + checked + @endif + >
diff --git a/motorradig/resources/views/tour/show.blade.php b/motorradig/resources/views/tour/show.blade.php index ca9c656..ec3cae8 100644 --- a/motorradig/resources/views/tour/show.blade.php +++ b/motorradig/resources/views/tour/show.blade.php @@ -55,8 +55,13 @@ @endif
- - + + is_cancelled) + checked + @endif + onclick="return false;" + >