schema([ Section::make('基础信息') ->schema([ TextInput::make('name') ->label('名称') ->required() ->maxLength(255), TextInput::make('key') ->label('标识键') ->helperText('前端模板使用 slotKey 识别') ->required() ->maxLength(64) ->unique(ignoreRecord: true), Textarea::make('description') ->label('描述') ->rows(2) ->nullable(), ])->columns(2), Section::make('配置') ->schema([ Toggle::make('is_active') ->label('启用') ->default(true), TextInput::make('max_items') ->label('最大展示数') ->numeric() ->default(3), TextInput::make('sort') ->label('排序') ->numeric() ->default(0), ])->columns(3), ]); } public static function table(Table $table): Table { return $table ->reorderable('sort') ->defaultSort('sort') ->columns([ TextColumn::make('name')->label('名称')->searchable()->sortable(), TextColumn::make('key')->label('标识键')->searchable(), IconColumn::make('is_active')->label('启用')->boolean(), TextColumn::make('max_items')->label('最大展示')->sortable(), TextColumn::make('ads_count')->label('广告数量')->counts('ads'), 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\ListAdSlots::route('/'), 'create' => Pages\CreateAdSlot::route('/create'), 'edit' => Pages\EditAdSlot::route('/{record}/edit'), ]; } }