> */ abstract protected function catalogRows(): array; /** * @return array Zustandsschlüssel => Bezeichnung, beginnend mit 'alle' */ abstract protected function zustandOptionen(): array; /** * @return array{0: string, 1: string} */ abstract protected function einheit(): array; /** * @return array{titel: string, text: string} */ abstract protected function leer(): array; protected function suchPlatzhalter(): string { return 'Name oder Beschreibung'; } public function getMaxContentWidth(): Width|string|null { return Width::Full; } public function content(Schema $schema): Schema { return $schema->components([View::make('filament.verwaltung.bestand')]); } public function resetFilters(): void { $this->suche = ''; $this->zustand = 'alle'; $this->bestandGrenze = Bestand::SCHRITT; } /** * @return array */ public function bestand(): array { $needle = mb_strtolower(trim($this->suche)); $rows = array_values(array_filter($this->catalogRows(), function (array $row) use ($needle): bool { if ($this->zustand !== 'alle' && ! in_array($this->zustand, $row['zustand'] ?? [], true)) { return false; } return $needle === '' || str_contains(mb_strtolower(implode(' ', array_filter([ $row['titel'], $row['meta'] ?? '', $row['text'] ?? '', $row['suchtext'] ?? '', ]))), $needle); })); return [ 'suche' => ['eigenschaft' => 'suche', 'label' => 'Suche', 'platzhalter' => $this->suchPlatzhalter()], 'filter' => [['eigenschaft' => 'zustand', 'label' => 'Zustand', 'vorgabe' => 'alle', 'optionen' => $this->zustandOptionen()]], 'zeilen' => $rows, 'einheit' => $this->einheit(), 'leer' => $this->leer(), ]; } }