- 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>
47 lines
1.6 KiB
PHP
Executable File
47 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Enums\ParticipantStatus;
|
|
use App\Models\Event;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$user = auth()->user();
|
|
|
|
$query = Event::with(['team', 'participants'])
|
|
->withCount([
|
|
'caterings as caterings_yes_count' => fn ($q) => $q->where('status', 'yes'),
|
|
'timekeepers as timekeepers_yes_count' => fn ($q) => $q->where('status', 'yes'),
|
|
])
|
|
->published();
|
|
|
|
if (! $user->canAccessAdminPanel()) {
|
|
$query->whereIn('team_id', $user->accessibleTeamIds());
|
|
}
|
|
|
|
// Alle Events für den Kalender
|
|
$calendarEvents = $query->orderBy('start_at')->get()
|
|
->map(fn (Event $e) => [
|
|
'id' => $e->id,
|
|
'title' => $e->title,
|
|
'type' => $e->type->value,
|
|
'typeLabel' => $e->type->label(),
|
|
'date' => $e->start_at->format('Y-m-d'),
|
|
'time' => $e->start_at->format('H:i'),
|
|
'team' => $e->team->name,
|
|
'url' => route('events.show', $e),
|
|
'tl' => [
|
|
'y' => $e->participants->where('status', ParticipantStatus::Yes)->count(),
|
|
'n' => $e->participants->where('status', ParticipantStatus::No)->count(),
|
|
'o' => $e->participants->where('status', ParticipantStatus::Unknown)->count(),
|
|
],
|
|
'minMet' => $e->minimumsStatus(),
|
|
]);
|
|
|
|
return view('dashboard', compact('calendarEvents'));
|
|
}
|
|
}
|