label('Benutzer anlegen'), ]; } protected function catalogRows(): array { $rows = []; foreach (User::query()->with('staffRoles')->orderBy('name')->get() as $user) { $status = $user->status instanceof AccountStatus ? $user->status->label() : (string) $user->status; $rollen = $user->staffRoles->map(fn ($role): string => $role->role instanceof StaffRole ? $role->role->label() : StaffRole::from((string) $role->role)->label())->all(); $url = UserResource::getUrl('edit', ['record' => $user]); $rows[] = [ 'schluessel' => 'u'.$user->id, 'titel' => (string) $user->name, 'meta' => (string) $user->email, 'symbol' => 'schluessel', 'url' => $url, 'chips' => [ ['label' => $status !== '' ? $status : 'Ohne Status', 'ton' => 'neutral'], ...array_map(fn (string $rolle): array => ['label' => $rolle, 'ton' => 'gut'], $rollen), ], 'zustand' => $rollen === [] ? ['ohne-rolle'] : ['mit-rolle'], 'aktionen' => [['label' => 'Bearbeiten', 'href' => $url, 'icon' => 'stift']], ]; } return $rows; } protected function zustandOptionen(): array { return ['alle' => 'Alle Konten', 'mit-rolle' => 'Mit Verwaltungsrolle', 'ohne-rolle' => 'Ohne Verwaltungsrolle']; } protected function einheit(): array { return ['Konto', 'Konten']; } protected function leer(): array { return ['titel' => 'Noch keine Konten', 'text' => 'Mit „Benutzer anlegen“ oben entsteht das erste Konto.']; } protected function suchPlatzhalter(): string { return 'Name oder E-Mail'; } }