42 lines
1.4 KiB
PHP
42 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Exports;
|
|
|
|
use App\Models\StatistikoDetail;
|
|
use Filament\Actions\Exports\ExportColumn;
|
|
use Filament\Actions\Exports\Exporter;
|
|
use Filament\Actions\Exports\Models\Export;
|
|
use Illuminate\Support\Number;
|
|
|
|
class DetailsExporter extends Exporter
|
|
{
|
|
protected static ?string $model = StatistikoDetail::class;
|
|
|
|
public static function getColumns(): array
|
|
{
|
|
return [
|
|
ExportColumn::make('ss_player_id'),
|
|
ExportColumn::make('ss_team_id'),
|
|
ExportColumn::make('player_name'),
|
|
ExportColumn::make('ss_national_team_id'),
|
|
ExportColumn::make('height'),
|
|
ExportColumn::make('nationality'),
|
|
ExportColumn::make('position'),
|
|
ExportColumn::make('preferred_foot'),
|
|
ExportColumn::make('last_update'),
|
|
ExportColumn::make('is_active'),
|
|
];
|
|
}
|
|
|
|
public static function getCompletedNotificationBody(Export $export): string
|
|
{
|
|
$body = 'Your StatistikoDetail export has completed and ' . Number::format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
|
|
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
|
$body .= ' ' . Number::format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
|
}
|
|
|
|
return $body;
|
|
}
|
|
}
|