schema([ Section::make('基础信息') ->schema([ TextInput::make('kp_code')->required()->maxLength(64), TextInput::make('name')->required()->maxLength(255), TextInput::make('subject')->maxLength(64), TextInput::make('grade')->maxLength(32), TextInput::make('parent_kp_code')->maxLength(64), ]) ->columns(2), ]); } public static function table(Tables\Table $table): Tables\Table { return $table ->columns([ TextColumn::make('kp_code')->label('编码')->searchable(), TextColumn::make('name')->label('名称')->searchable(), TextColumn::make('subject')->label('学科')->sortable(), TextColumn::make('grade')->label('年级')->sortable(), TextColumn::make('updated_at')->label('更新')->dateTime(), ]) ->filters([ SelectFilter::make('subject') ->options([ 'math' => '数学', 'physics' => '物理', ]), ]) ->actions([ Action::make('view') ->label('查看') ->icon('heroicon-o-eye') ->url(fn (KnowledgePoint $record) => static::getUrl('view', ['record' => $record])), EditAction::make(), ]) ->bulkActions([ BulkActionGroup::make([]), ]); } public static function getPages(): array { return [ 'index' => Pages\ListKnowledgePoints::route('/'), 'create' => Pages\CreateKnowledgePoint::route('/create'), 'view' => Pages\ViewKnowledgePoint::route('/{record}'), 'edit' => Pages\EditKnowledgePoint::route('/{record}/edit'), ]; } }