Stand: SMTP-Test, Admin-Mail-Tab, Notifiable-Fix, Lazy-Quill
- Fix: Notifiable-Trait zum User-Model hinzugefuegt (behebt notify()-500er) - Installer: SMTP-Verbindungstest mit EsmtpTransport + Ueberspringen-Link - Admin: Neuer E-Mail-Tab mit SMTP-Konfiguration + Verbindungstest - Admin: Lazy Quill-Initialisierung (nur sichtbare Locale wird geladen) - Uebersetzungen: 17 neue Mail-Keys in allen 6 Sprachen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
55
app/Http/Controllers/TimekeeperController.php
Executable file
55
app/Http/Controllers/TimekeeperController.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\CateringStatus;
|
||||
use App\Enums\EventStatus;
|
||||
use App\Models\ActivityLog;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventTimekeeper;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TimekeeperController extends Controller
|
||||
{
|
||||
public function update(Request $request, Event $event): RedirectResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($event->status === EventStatus::Cancelled) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
if (!$event->type->hasTimekeepers()) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
if (!$user->canAccessAdminPanel()) {
|
||||
if ($event->status === EventStatus::Draft) {
|
||||
abort(403);
|
||||
}
|
||||
if (!$user->accessibleTeamIds()->contains($event->team_id)) {
|
||||
abort(403);
|
||||
}
|
||||
}
|
||||
|
||||
$request->validate([
|
||||
'status' => 'required|in:yes,no,unknown',
|
||||
]);
|
||||
|
||||
$existing = EventTimekeeper::where('event_id', $event->id)->where('user_id', auth()->id())->first();
|
||||
$oldStatus = $existing?->status?->value ?? 'unknown';
|
||||
|
||||
$timekeeper = EventTimekeeper::where('event_id', $event->id)->where('user_id', auth()->id())->first();
|
||||
if (!$timekeeper) {
|
||||
$timekeeper = new EventTimekeeper(['event_id' => $event->id]);
|
||||
$timekeeper->user_id = auth()->id();
|
||||
}
|
||||
$timekeeper->status = CateringStatus::from($request->status);
|
||||
$timekeeper->save();
|
||||
|
||||
ActivityLog::logWithChanges('status_changed', __('admin.log_timekeeper_changed', ['event' => $event->title, 'status' => $request->status]), 'Event', $event->id, ['status' => $oldStatus, 'user_id' => auth()->id(), 'source' => 'timekeeper'], ['status' => $request->status, 'user_id' => auth()->id(), 'source' => 'timekeeper']);
|
||||
|
||||
return redirect(route('events.show', $event) . '#timekeeper');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user