Skip to content

Commit

Permalink
🚸 make event editable in backend (#2842)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu authored Aug 11, 2024
1 parent 24e8cd9 commit ecce034
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/Http/Controllers/Frontend/Admin/StatusEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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']);
Expand Down Expand Up @@ -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']]);
Expand Down
12 changes: 12 additions & 0 deletions resources/views/admin/status/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@
</div>
</div>

<div class="mb-4">
<div class="row">
<div class="col-4">
<label class="form-label" for="form-origin">Event ID</label>
</div>
<div class="col-8">
<input type="text" class="form-control" name="event_id"
value="{{$status->event_id}}">
</div>
</div>
</div>

<small class="text-danger">Achtung: Hier sind Admin-Handlungen möglich. Die Änderungen werden
nicht auf Plausibilität geprüft!</small>
<button type="submit" class="btn btn-primary btn-block">Speichern</button>
Expand Down

0 comments on commit ecce034

Please sign in to comment.