labels(); return $schema->components([ TextInput::make('path') ->label('Pfad') ->required() ->maxLength(255) ->helperText('Zum Beispiel / oder /praevention'), TextInput::make('seo_title') ->label('SEO-Titel') ->maxLength(255), Textarea::make('seo_description') ->label('SEO-Beschreibung') ->maxLength(500) ->columnSpanFull(), Repeater::make('blocks') ->label('Bausteine') ->schema([ Select::make('type') ->label('Typ') ->options($labels) ->required() ->live(), TextInput::make('heading') ->label('Überschrift') ->visible(fn (Get $get): bool => in_array($get('type'), ['heading', 'call_to_action'], true)), Textarea::make('intro') ->label('Einleitung') ->visible(fn (Get $get): bool => $get('type') === 'heading'), Textarea::make('body') ->label('Text') ->visible(fn (Get $get): bool => in_array($get('type'), ['prose', 'image_text'], true)) ->columnSpanFull(), FileUpload::make('image') ->label('Bild') ->disk('cms_incoming') ->directory('cms') ->image() ->visible(fn (Get $get): bool => $get('type') === 'image_text'), TextInput::make('alt') ->label('Alternativtext') ->visible(fn (Get $get): bool => $get('type') === 'image_text'), Textarea::make('text') ->label('Text') ->visible(fn (Get $get): bool => $get('type') === 'call_to_action'), TextInput::make('label') ->label('Beschriftung der Aktion') ->visible(fn (Get $get): bool => $get('type') === 'call_to_action'), TextInput::make('url') ->label('Adresse') ->visible(fn (Get $get): bool => $get('type') === 'call_to_action'), Repeater::make('items') ->label('Einträge') ->visible(fn (Get $get): bool => in_array($get('type'), ['cards', 'faq'], true)) ->schema([ TextInput::make('title')->label('Titel')->visible(fn (Get $get): bool => $get('../../type') === 'cards'), Textarea::make('text')->label('Text')->visible(fn (Get $get): bool => $get('../../type') === 'cards'), TextInput::make('url')->label('Adresse')->visible(fn (Get $get): bool => $get('../../type') === 'cards'), TextInput::make('question')->label('Frage')->visible(fn (Get $get): bool => $get('../../type') === 'faq'), Textarea::make('answer')->label('Antwort')->visible(fn (Get $get): bool => $get('../../type') === 'faq'), ]), ]) ->columnSpanFull() ->reorderable() ->collapsed(), ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('path')->label('Pfad')->searchable(), TextColumn::make('published_revision_id') ->label('Veröffentlicht') ->formatStateUsing(fn ($state): string => $state ? 'Ja' : 'Entwurf'), TextColumn::make('updated_at')->label('Geändert')->dateTime('d.m.Y H:i'), ]) ->recordUrl(fn (Page $record): string => static::getUrl('edit', ['record' => $record])); } public static function getRelations(): array { return [ RevisionsRelationManager::class, ]; } public static function getPages(): array { return [ 'index' => ListPages::route('/'), 'create' => CreatePage::route('/create'), 'edit' => EditPage::route('/{record}/edit'), ]; } }