class EarningExporter extends Exporter
{
protected static ?string $model = Earning::class;
public static function getColumns(): array
{
return [
ExportColumn::make('id')
->label('ID'),
ExportColumn::make('user_id'),
ExportColumn::make('user.full_name'),
ExportColumn::make('earningCutOff.name'),
ExportColumn::make('earnable_id'),
ExportColumn::make('earnable.full_name')
->label('Reference'),
ExportColumn::make('reference_package_name'),
ExportColumn::make('amount'),
ExportColumn::make('type')
->getStateUsing(fn ($record) => $record->type->getLabel()),
ExportColumn::make('points'),
ExportColumn::make('status')
->getStateUsing(fn ($record) => $record->status->getLabel()),
ExportColumn::make('level'),
ExportColumn::make('earned_at'),
ExportColumn::make('created_at'),
ExportColumn::make('updated_at'),
];
}