58 lines
2.0 KiB
PHP
58 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Exports;
|
|
|
|
use App\Models\StatistikoEvent;
|
|
use Filament\Actions\Exports\ExportColumn;
|
|
use Filament\Actions\Exports\Exporter;
|
|
use Filament\Actions\Exports\Models\Export;
|
|
use Illuminate\Support\Number;
|
|
|
|
class EventsHistoryExporter extends Exporter
|
|
{
|
|
protected static ?string $model = StatistikoEvent::class;
|
|
|
|
public static function getColumns(): array
|
|
{
|
|
return [
|
|
ExportColumn::make('match_id'),
|
|
ExportColumn::make('sport_id'),
|
|
ExportColumn::make('league_id'),
|
|
ExportColumn::make('home_id'),
|
|
ExportColumn::make('away_id'),
|
|
ExportColumn::make('starttime'),
|
|
ExportColumn::make('season'),
|
|
ExportColumn::make('gls_h'),
|
|
ExportColumn::make('gls_a'),
|
|
ExportColumn::make('crn_h'),
|
|
ExportColumn::make('crn_a'),
|
|
ExportColumn::make('fls_h'),
|
|
ExportColumn::make('fls_a'),
|
|
ExportColumn::make('ofs_h'),
|
|
ExportColumn::make('ofs_a'),
|
|
ExportColumn::make('snt_h'),
|
|
ExportColumn::make('snt_a'),
|
|
ExportColumn::make('tsh_h'),
|
|
ExportColumn::make('tsh_a'),
|
|
ExportColumn::make('crd_h'),
|
|
ExportColumn::make('crd_a'),
|
|
ExportColumn::make('exp_home'),
|
|
ExportColumn::make('exp_away'),
|
|
ExportColumn::make('exp_handicap'),
|
|
ExportColumn::make('exp_total'),
|
|
ExportColumn::make('result_code'),
|
|
];
|
|
}
|
|
|
|
public static function getCompletedNotificationBody(Export $export): string
|
|
{
|
|
$body = 'Your events history 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;
|
|
}
|
|
}
|