schema([ Section::make('基础信息') ->schema([ TextInput::make('name') ->label('名称') ->required() ->maxLength(255), TextInput::make('slug') ->label('Slug') ->required() ->maxLength(255), Select::make('parent_id') ->label('父级分类') ->relationship('parent', 'name') ->searchable() ->preload() ->nullable(), TextInput::make('icon') ->label('图标') ->maxLength(255) ->nullable(), Textarea::make('description') ->label('描述') ->rows(3) ->nullable(), TextInput::make('sort') ->label('排序') ->numeric() ->default(0), ])->columns(2), Section::make('SEO') ->schema([ TextInput::make('seo_title') ->label('SEO 标题') ->maxLength(255) ->nullable(), TextInput::make('seo_description') ->label('SEO 描述') ->maxLength(255) ->nullable(), ])->columns(2), ]); } public static function table(Table $table): Table { return $table ->reorderable('sort') ->defaultSort('sort') ->columns([ TextColumn::make('name')->label('名称')->searchable()->sortable(), TextColumn::make('slug')->label('Slug')->searchable(), TextColumn::make('parent.name')->label('父级'), TextColumn::make('sort')->label('排序')->sortable(), TextColumn::make('created_at')->label('创建时间')->dateTime(), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]) ->emptyStateActions([ Tables\Actions\CreateAction::make(), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListCategories::route('/'), 'create' => Pages\CreateCategory::route('/create'), 'edit' => Pages\EditCategory::route('/{record}/edit'), ]; } }