$this->visibleGroups(), ])->title(__('setup.title')); } /** * Nur, was dieser Betreiber auch öffnen darf — und keine leere Gruppe. * * Eine Kachel, die zu einer 403 führt, ist schlimmer als eine fehlende: * sie sieht aus wie ein Weg. Dieselbe Prüfung, die x-shell.nav je Eintrag * anwendet, damit beide Wege zu einer Seite dieselbe Antwort geben. * * @return array> */ private function visibleGroups(): array { $sichtbar = []; foreach (Navigation::setup() as $gruppe => $kacheln) { $erlaubt = array_values(array_filter( $kacheln, fn (array $kachel) => $this->mayOpen($kachel[3]), )); if ($erlaubt !== []) { $sichtbar[$gruppe] = $erlaubt; } } return $sichtbar; } private function mayOpen(mixed $capability): bool { if ($capability === null) { return true; } $betreiber = auth('operator')->user(); return is_array($capability) ? collect($capability)->contains(fn (string $eine) => (bool) $betreiber?->can($eine)) : (bool) $betreiber?->can($capability); } }