From ecce034a6ad6f43afed2508cd670a7cb593d61dd Mon Sep 17 00:00:00 2001 From: Kris Date: Sun, 11 Aug 2024 10:48:33 +0200 Subject: [PATCH] :children_crossing: make `event` editable in backend (#2842) --- .../Frontend/Admin/StatusEditController.php | 8 ++++++-- resources/views/admin/status/edit.blade.php | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Frontend/Admin/StatusEditController.php b/app/Http/Controllers/Frontend/Admin/StatusEditController.php index 6f0d568ac..6db4187c8 100644 --- a/app/Http/Controllers/Frontend/Admin/StatusEditController.php +++ b/app/Http/Controllers/Frontend/Admin/StatusEditController.php @@ -8,8 +8,8 @@ use App\Http\Controllers\Backend\Transport\PointsCalculationController; use App\Http\Controllers\Backend\Transport\TrainCheckinController; use App\Http\Controllers\Controller; -use App\Models\Status; use App\Models\Station; +use App\Models\Status; use App\Models\User; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -55,6 +55,7 @@ public function edit(Request $request): RedirectResponse { 'destination' => ['required', 'exists:train_stations,id'], 'body' => ['nullable', 'string'], 'visibility' => ['required', new Enum(StatusVisibility::class)], + 'event_id' => ['nullable', 'integer', 'exists:events,id'], ]); $status = Status::find($validated['statusId']); @@ -100,7 +101,10 @@ public function edit(Request $request): RedirectResponse { StatusUpdateEvent::dispatch($status->refresh()); - $status->update(['visibility' => $validated['visibility']]); + $status->update([ + 'visibility' => $validated['visibility'], + 'event_id' => $validated['event_id'], + ]); if ($status->body !== $validated['body']) { $status->update(['body' => $validated['body']]); diff --git a/resources/views/admin/status/edit.blade.php b/resources/views/admin/status/edit.blade.php index d6939c1f9..ccb19dbe8 100644 --- a/resources/views/admin/status/edit.blade.php +++ b/resources/views/admin/status/edit.blade.php @@ -160,6 +160,18 @@ +
+
+
+ +
+
+ +
+
+
+ Achtung: Hier sind Admin-Handlungen möglich. Die Änderungen werden nicht auf Plausibilität geprüft!