season in countries

This commit is contained in:
salam committed 2026-06-15 15:41:40 +02:00
1 parent ff4a4d9544
commit 0b9e99e844
4 files changed
+42 -2

No files matched your search

@@ -6,9 +6,12 @@ use App\Filament\Clusters\StaticData\Resources\Countries\Pages\ManageCountries;
use App\Filament\Clusters\StaticData\StaticDataCluster;
use App\Filament\Exports\CountryExporter;
use App\Models\Country;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\EditAction;
use Filament\Actions\ExportAction;
use Filament\Actions\Exports\Enums\ExportFormat;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Resources\Resource;
@@ -21,6 +24,7 @@ use Filament\Tables\Filters\Filter;
use Filament\Tables\Filters\TernaryFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
class CountryResource extends Resource
{
@@ -44,6 +48,11 @@ class CountryResource extends Resource
TextInput::make('numeric'),
Toggle::make('is_country'),
Toggle::make('disabled')->label('Disable')->aboveLabel(['Hide in this table']),
Select::make('season_mode')
->options([
'halfyear' => 'Half Year (25/26)',
'fullyear' => 'Full Year (2026)',
])
]);
}
@@ -60,6 +69,13 @@ class CountryResource extends Resource
->searchable()
->color('primary')
->copyable(),
TextColumn::make('season_mode')
->badge()
->formatStateUsing(fn(string $state): string => strtoupper($state))
->color(fn(string $state): string => match ($state) {
'halfyear' => 'warning',
'fullyear' => 'success',
}),
IconColumn::make('icon')
->sortable()
->icon(function ($state): string {
@@ -98,6 +114,26 @@ class CountryResource extends Resource
])
->recordActions([
EditAction::make()->hiddenLabel(),
])->toolbarActions([
BulkActionGroup::make([
BulkAction::make('season_mode')
->icon('phosphor-calendar')
->action(function (Collection $records, array $data): void {
foreach ($records as $record) {
Country::where('id', '=', $record->id)
->update(
['season_mode' => $data['season_mode']]
);
}
})
->schema([
Select::make('season_mode')
->options([
'halfyear' => 'Half Year (25/26)',
'fullyear' => 'Full Year (2026)',
])
]),
]),
]);
}
+4 -2
View File
@@ -31,7 +31,8 @@ class ImportEvents
3 => 1661
4 => 4781
*/
StatistikoEvent::updateOrCreate([
StatistikoEvent::updateOrCreate(
[
'match_id' => (int) $row[0],
'sport_id' => (int) $row[1],
'league_id' => (int) $row[2],
@@ -62,7 +63,8 @@ class ImportEvents
'result_code' => $row[25], // w, d, l
'created_at' => $now,
'updated_at' => $now,
]);
]
);
// StatistikoEvent::where('match_id', (int) $row[0])
// ->where('sport_id', (int) $row[1])
+1
View File
@@ -13,6 +13,7 @@ class Country extends Model
'iso2',
'iso3',
'cc',
'season_mode',
'is_country',
'disabled',
];
@@ -20,6 +20,7 @@ return new class extends Migration
$table->string('cc')->nullable();
$table->boolean('is_country')->default(0);
$table->boolean('disabled')->default(0);
$table->string('season_mode')->nullable();
$table->timestamps();
});
}