schema([ Forms\Components\Select::make('category_id') ->label('Category') ->relationship('category', 'name') ->searchable() ->required() ->createOptionForm([ Forms\Components\TextInput::make('name') ->required() ->maxLength(255), Forms\Components\TextInput::make('slug') ->required() ->maxLength(255), Forms\Components\Textarea::make('description'), ]) ->placeholder('Select a category'), Forms\Components\TextInput::make('title') ->label('Title') ->required() ->maxLength(255) ->live(onBlur: true) ->afterStateUpdated(function (Get $get, Set $set, ?string $old, ?string $state) { if (($get('slug') ?? '') !== Str::slug($old)) { return; } $set('slug', Str::slug($state)); }) ->placeholder('Fill in the name for your article'), Forms\Components\TextInput::make('slug') ->label('Slug') ->required() ->maxLength(255) ->placeholder('Fill in the name for your article'), Forms\Components\TextInput::make('description') ->label('Description') ->required() ->maxLength(255) ->placeholder('Small description'), Forms\Components\DateTimePicker::make('published_at') ->label('Published at') ->required() ->placeholder('Date and time of publishment'), Forms\Components\Toggle::make('is_active') ->label('Published') ->default(false), Forms\Components\RichEditor::make('content') ->columnSpanFull() ->label('Content') ->required() ->placeholder('Enter the content of the article'), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('title') ->searchable() ->sortable(), Tables\Columns\TextColumn::make('category.name') ->label('Category') ->sortable(), Tables\Columns\TextColumn::make('published_at') ->searchable() ->dateTime() ->sortable(), Tables\Columns\IconColumn::make('is_active') ->label('Published') ->boolean() ->sortable(), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getPages(): array { return [ 'index' => Pages\ListKnowledgeBase::route('/'), 'create' => Pages\CreateKnowledgeBase::route('/create'), 'edit' => Pages\EditKnowledgeBase::route('/{record}/edit'), ]; } }