From c6c5cdc1b1591676313f1096bf71c172a16b988e Mon Sep 17 00:00:00 2001 From: salam Date: Tue, 25 Aug 2026 08:03:22 +0200 Subject: [PATCH] wip --- app/Actions/LoadSofaScoreCategory.php | 23 ++ .../LoadStatisticFixturesLeaguesOptions.php | 19 +- .../Commands/Grapper/Sofascore/SqlMover.php | 20 +- .../Grapper/Sofascore/SqlMover/country.txt | 51 +++ .../Pages/CreateSofaScoreCategory.php | 11 + .../Pages/EditSofaScoreCategory.php | 19 ++ .../Pages/ListSofaScoreCategories.php | 19 ++ .../Schemas/SofaScoreCategoryForm.php | 29 ++ .../SofaScoreCategoryResource.php | 53 ++++ .../Tables/SofaScoreCategoriesTable.php | 49 +++ .../Tables/SofaScoreRosasTable.php | 2 +- .../Tables/SofaScoreTournamentsTable.php | 4 +- .../Tables/StatisticFixturesTable.php | 6 + .../Tables/StatistikoEventsTable.php | 8 + app/Filament/Pages/Statistic.php | 22 +- app/Filament/Widgets/Data/LoadEvents.php | 2 +- .../Data/LoadEvents/LoadEventsQuery.php | 3 +- app/Models/SofaScoreCategory.php | 8 +- app/Models/SofaScoreRosa.php | 5 + ...147_create_sofa_score_categories_table.php | 4 +- .../SofaScorePlayerCategorieSeeder.php | 297 ++++++++++++++++++ 21 files changed, 620 insertions(+), 34 deletions(-) create mode 100644 app/Actions/LoadSofaScoreCategory.php create mode 100644 app/Console/Commands/Grapper/Sofascore/SqlMover/country.txt create mode 100644 app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Pages/CreateSofaScoreCategory.php create mode 100644 app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Pages/EditSofaScoreCategory.php create mode 100644 app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Pages/ListSofaScoreCategories.php create mode 100644 app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Schemas/SofaScoreCategoryForm.php create mode 100644 app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/SofaScoreCategoryResource.php create mode 100644 app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Tables/SofaScoreCategoriesTable.php create mode 100644 database/seeders/SofaScorePlayerCategorieSeeder.php diff --git a/app/Actions/LoadSofaScoreCategory.php b/app/Actions/LoadSofaScoreCategory.php new file mode 100644 index 00000000..31673c97 --- /dev/null +++ b/app/Actions/LoadSofaScoreCategory.php @@ -0,0 +1,23 @@ +groupBy('league_id') + ->pluck('league_id')->toArray(); + + $sofa_score_category_id = SofaScoreTournament::whereIn('tournament_id', $league_ids)->pluck('sofa_score_category_id')->toArray(); + + $sofa_score_category_id = array_unique($sofa_score_category_id); + + return SofaScoreCategory::where('in_soccer', 1)->whereIn('id', $sofa_score_category_id)->orderBy('name')->pluck('name', 'id'); + } +} diff --git a/app/Actions/LoadStatisticFixturesLeaguesOptions.php b/app/Actions/LoadStatisticFixturesLeaguesOptions.php index b190e771..78e62c5a 100644 --- a/app/Actions/LoadStatisticFixturesLeaguesOptions.php +++ b/app/Actions/LoadStatisticFixturesLeaguesOptions.php @@ -3,24 +3,15 @@ namespace App\Actions; use App\Models\SofaScoreTournament; -use App\Models\StatisticFixtures; class LoadStatisticFixturesLeaguesOptions { - public static function load(int $sport_id) + public static function load(int|null $sofascore_category_id = 0) { - $res = StatisticFixtures::where('sport_id', $sport_id) - ->groupBy('league_id') - ->pluck('league_id')->toArray(); + // $res = StatisticFixtures::with('league')->where('league_id', $sofascore_category_id) + // ->groupBy('league_id') + // ->pluck('league_id')->toArray(); - $cnt = SofaScoreTournament::with('sofascore_category')->whereIn('tournament_id', $res)->get(); - $arr = []; - foreach ($cnt as $val) { - $arr[$val->tournament_id] = $val->sofascore_category->name . ' ' . $val->name; - } - - asort($arr); - - return $arr; + return SofaScoreTournament::where('enabled', 1)->where('sofa_score_category_id', $sofascore_category_id)->orderBy('name')->pluck('name', 'tournament_id'); } } diff --git a/app/Console/Commands/Grapper/Sofascore/SqlMover.php b/app/Console/Commands/Grapper/Sofascore/SqlMover.php index c5757b89..014c7182 100644 --- a/app/Console/Commands/Grapper/Sofascore/SqlMover.php +++ b/app/Console/Commands/Grapper/Sofascore/SqlMover.php @@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\Sofascore; use App\Console\Commands\Grap; use App\Console\Commands\Grapper\Sofascore\Helper\ReadDir; use App\Console\Commands\Grapper\Sofascore\Helper\Strings; +use App\Models\SofaScoreCategory; use App\Models\SofaScoreRosa; use App\Models\SofaScoreTask; use App\Models\StatistikoEvent; @@ -25,15 +26,22 @@ class SqlMover // $files = ReadDir::get_tree($sofascore_data . $folder); // dd($files); - $file = file_get_contents(__dir__ . '/SqlMover/grapped.txt'); + $file = file_get_contents(__dir__ . '/SqlMover/country.txt'); $data = explode(PHP_EOL, $file); - $arr = []; - foreach ($data as $value) { - if (strpos($value, 'Grapped', 0) !== false) { - $arr[] = $value; + foreach ($data as $key => $value) { + if ($key) { + $row = explode(',', $value); + $country_id = $row[0]; + $flag = $row[2]; + $season_mode = $row[6]; + SofaScoreCategory::where('country_id', $country_id)->update([ + 'season_mode' => $season_mode, + 'flag' => $flag, + 'in_soccer' => 1, + ]); } } - Notice::note($arr, '', 1); + Notice::note('DONE', 'r', 1); // Notice::note('StatistikoPlayer', 'b'); diff --git a/app/Console/Commands/Grapper/Sofascore/SqlMover/country.txt b/app/Console/Commands/Grapper/Sofascore/SqlMover/country.txt new file mode 100644 index 00000000..62e594f1 --- /dev/null +++ b/app/Console/Commands/Grapper/Sofascore/SqlMover/country.txt @@ -0,0 +1,51 @@ +id,name,icon,iso2,iso3,cc,season_mode,is_country,disabled,created_at,updated_at +467,Argentina,flag-country-ar,AR,ARG,ARG,fullyear,1,0,NULL,2026-06-15 17:26:31 +454,Australia,flag-country-au,AU,AUS,AUS,halfyear,1,0,NULL,2026-06-15 17:21:02 +383,Austria,flag-country-at,AT,AUT,AUT,halfyear,1,0,NULL,2026-06-15 15:46:53 +377,Belgium,flag-country-be,BE,BEL,BEL,halfyear,1,0,NULL,2026-06-15 17:21:02 +409,Brazil,flag-country-br,BR,BRA,BRA,fullyear,1,0,NULL,2026-06-15 15:46:11 +363,Bulgaria,flag-country-bg,BG,BGR,BUL,halfyear,1,0,NULL,2026-06-15 17:22:37 +424,China,flag-country-cn,CN,CHN,CHN,fullyear,1,0,NULL,2026-06-15 15:44:40 +389,Colombia,flag-country-co,CO,COL,COL,fullyear,1,0,NULL,2026-06-15 17:25:12 +415,Croatia,flag-country-hr,HR,HRV,CRO,NULL,1,0,NULL,NULL +468,Czech Republic,flag-country-cz,CZ,CZE,CZE,NULL,1,0,NULL,2025-08-30 05:52:59 +378,Denmark,flag-country-dk,DK,DNK,DEN,fullyear,1,0,NULL,2026-06-15 17:25:12 +382,England,extra-england,NULL,ENG,ENG,NULL,1,0,2025-05-24 06:40:45,2025-05-24 06:40:45 +678,Europe,flag-country-eu,NULL,NULL,REUROPE,NULL,0,0,2026-02-24 16:28:34,2026-02-24 16:30:36 +381,European Cup,flag-country-eu,NULL,NULL,ECUP,halfyear,1,0,2025-08-30 04:45:37,2026-06-15 17:21:02 +403,Finland,flag-country-fi,FI,FIN,FIN,fullyear,1,0,NULL,2026-06-15 17:25:12 +408,France,flag-country-fr,FR,FRA,FRA,halfyear,1,0,NULL,2026-06-15 15:47:10 +446,Germany,flag-country-de,DE,DEU,GER,halfyear,1,0,NULL,2026-06-15 15:47:39 +394,Greece,flag-country-gr,GR,GRC,GRE,halfyear,1,0,NULL,2026-06-15 17:21:02 +407,Holland,flag-country-nl,NL,NLD,DUT,halfyear,1,0,NULL,2026-06-15 17:21:02 +412,Hungary,flag-country-hu,HU,HUN,HUN,halfyear,1,0,NULL,2026-06-15 17:21:02 +373,Iceland,flag-country-is,IS,NULL,ICE,NULL,1,0,2025-08-30 04:45:33,2025-08-30 05:52:59 +466,International,extra-caf,NULL,NULL,INT,NULL,1,0,2025-08-30 04:45:33,2025-08-30 05:52:59 +543,International Cup,extra-world,NULL,NULL,ICUP,NULL,1,0,2025-08-30 04:45:36,2025-08-30 05:52:59 +435,Ireland,flag-country-ie,IE,IRL,IRE,NULL,1,0,NULL,NULL +398,Italy,flag-country-it,IT,ITA,ITA,halfyear,1,0,NULL,2026-06-15 15:46:41 +416,Japan,flag-country-jp,JP,JPN,JPN,fullyear,1,0,NULL,2026-06-15 15:44:23 +406,Major League Soccer,NULL,NULL,NULL,MLS,fullyear,1,0,2025-08-30 04:45:33,2026-06-15 17:25:12 +413,Mexico,flag-country-mx,MX,MEX,MEX,halfyear,1,0,NULL,2026-06-15 17:21:02 +426,Northern Ireland,extra-nordirland,NULL,NIR,NIR,NULL,1,0,2025-05-24 06:40:45,2025-05-24 06:40:45 +431,Norway,flag-country-no,NO,NOR,NOR,fullyear,1,0,NULL,2026-06-15 15:45:46 +457,Peru,flag-country-pe,PE,PER,PER,NULL,1,0,NULL,2025-05-24 06:40:45 +386,Poland,flag-country-pl,PL,POL,POL,halfyear,1,0,NULL,2026-06-15 17:21:02 +418,Portugal,flag-country-pt,PT,PRT,POR,halfyear,1,0,NULL,2026-06-15 17:21:02 +443,Romania,flag-country-ro,RO,ROU,ROM,halfyear,1,0,NULL,2026-06-15 17:21:02 +368,Russia,flag-country-ru,RU,RUS,RUS,halfyear,1,0,NULL,2026-06-15 17:21:02 +462,Saudi Arabia,flag-country-sa,SA,SAU,KSA,halfyear,1,0,NULL,2026-06-15 17:21:02 +449,Scotland,extra-scotland,NULL,SCO,SCO,halfyear,1,0,2025-05-24 06:40:45,2026-06-15 17:21:02 +428,Serbia,flag-country-rs,RS,SRB,SRB,halfyear,1,0,NULL,2026-06-15 17:21:02 +391,Slovakia,flag-country-sk,SK,SVK,SVK,halfyear,1,0,NULL,2026-06-15 17:21:02 +441,Slovenia,flag-country-si,SI,SVN,SLO,halfyear,1,0,NULL,2026-06-15 17:21:02 +680,South America,extra-world,NULL,NULL,RSOAM,NULL,0,0,2026-02-24 16:28:34,2026-02-24 16:28:34 +465,South America Cup,extra-world,NULL,NULL,SACUP,NULL,0,0,2026-02-24 16:28:34,2026-02-24 16:28:34 +437,South Korea,flag-country-kr,KR,KOR,KOR,fullyear,1,0,NULL,2026-06-15 17:25:12 +438,Spain,flag-country-es,ES,ESP,SPA,halfyear,1,0,NULL,2026-06-15 17:21:02 +410,Sweden,flag-country-se,SE,SWE,SWE,fullyear,1,0,NULL,2026-06-15 15:45:31 +451,Switzerland,flag-country-ch,CH,CHE,SWI,halfyear,1,0,NULL,2026-06-15 17:21:02 +405,Turkey,flag-country-tr,TR,TUR,TUR,halfyear,1,0,NULL,2026-06-15 17:21:02 +452,Ukraine,flag-country-ua,UA,UKR,UKR,halfyear,1,0,NULL,2026-06-15 17:21:02 +1,World,extra-world,NULL,NULL,NULL,NULL,0,0,NULL,NULL +531,World Club Cup,NULL,NULL,NULL,WCLUB,NULL,0,0,2026-02-24 16:28:34,2026-02-24 16:28:34 \ No newline at end of file diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Pages/CreateSofaScoreCategory.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Pages/CreateSofaScoreCategory.php new file mode 100644 index 00000000..ac48285f --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Pages/CreateSofaScoreCategory.php @@ -0,0 +1,11 @@ +components([ + TextInput::make('name') + ->required(), + TextInput::make('slug') + ->required(), + TextInput::make('season_mode') + ->default(null), + TextInput::make('flag') + ->default(null), + Toggle::make('in_soccer'), + TextInput::make('country_id') + ->numeric() + ->default(null), + ]); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/SofaScoreCategoryResource.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/SofaScoreCategoryResource.php new file mode 100644 index 00000000..af8388fe --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/SofaScoreCategoryResource.php @@ -0,0 +1,53 @@ + ListSofaScoreCategories::route('/'), + ]; + } + + public static function getNavigationBadge(): ?string + { + return parent::getEloquentQuery()->count(); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Tables/SofaScoreCategoriesTable.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Tables/SofaScoreCategoriesTable.php new file mode 100644 index 00000000..9e98412b --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreCategories/Tables/SofaScoreCategoriesTable.php @@ -0,0 +1,49 @@ +columns([ + IconColumn::make('flag') + ->sortable() + ->icon(function ($state): string { + return $state; + })->label('Flags'), + TextColumn::make('name') + ->searchable(), + TextColumn::make('season_mode') + ->sortable() + ->badge() + ->formatStateUsing(fn(string $state): string => strtoupper($state)) + ->color(fn(string $state): string => match ($state) { + 'halfyear' => 'warning', + 'fullyear' => 'success', + default => '' + }), + IconColumn::make('in_soccer') + ->boolean(), + TextColumn::make('country_id') + ->numeric() + ->sortable(), + ]) + ->filters([ + TernaryFilter::make('in_soccer')->default(1) + ]) + ->recordActions([ + EditAction::make(), + ]); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/Tables/SofaScoreRosasTable.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/Tables/SofaScoreRosasTable.php index c681a3d3..126b3fc8 100644 --- a/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/Tables/SofaScoreRosasTable.php +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/Tables/SofaScoreRosasTable.php @@ -22,7 +22,7 @@ class SofaScoreRosasTable ->columns([ TextColumn::make('ss_team_id')->label('SSId')->badge()->width('1rem') ->sortable(), - TextColumn::make('country.name')->label('Country') + TextColumn::make('sofascore_category.name')->label('Country') ->sortable(), TextColumn::make('tournament_rosa.tournament.name')->label('Tournament') ->sortable(), diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php index c4cf2151..15d9f9df 100644 --- a/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php @@ -41,7 +41,7 @@ class SofaScoreTournamentsTable ->searchable(), TextColumn::make('sofascore_category.name') ->label('Country') - ->icon(fn($record) => $record->sofascore_category->country->icon) + ->icon(fn($record) => $record->sofascore_category->flag) ->sortable(), TextColumn::make('name')->searchable()->sortable(), ToggleColumn::make('enabled') @@ -76,7 +76,7 @@ class SofaScoreTournamentsTable return SofaScoreCategory::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id'); }) ->live(), - Toggle::make('enabled')->label('In Statistiko'), + Toggle::make('enabled')->label('In Statistiko')->default(1), ]) ->query(function (Builder $query, array $data): Builder { return $query->when( diff --git a/app/Filament/Clusters/StaticData/Resources/StatisticFixtures/Tables/StatisticFixturesTable.php b/app/Filament/Clusters/StaticData/Resources/StatisticFixtures/Tables/StatisticFixturesTable.php index 7cb162f2..f4046f35 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatisticFixtures/Tables/StatisticFixturesTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatisticFixtures/Tables/StatisticFixturesTable.php @@ -31,8 +31,14 @@ class StatisticFixturesTable '3' => 'icon-basketball', '5' => 'icon-tennisball', }), + IconColumn::make('league.sofascore_category.flag') + ->label('') + ->icon(function ($state): string { + return $state; + }), TextColumn::make('league.name') ->label('League') + ->tooltip(fn($record) => $record->league_id) ->sortable() ->searchable() ->description( diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoEvents/Tables/StatistikoEventsTable.php b/app/Filament/Clusters/StaticData/Resources/StatistikoEvents/Tables/StatistikoEventsTable.php index c47c8bb5..a65bdfb3 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoEvents/Tables/StatistikoEventsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoEvents/Tables/StatistikoEventsTable.php @@ -38,15 +38,23 @@ class StatistikoEventsTable ->searchable( query: fn($query, $search) => $query->orWhere('match_id', (int) $search) ), + IconColumn::make('league.sofascore_category.flag') + ->label('') + ->icon(function ($state): string { + return $state; + }), TextColumn::make('league.name') + ->tooltip(fn($record) => $record->league_id) ->sortable( query: fn(Builder $query) => $query->orderBy('name') ) ->searchable(), TextColumn::make('home.ss_team_name')->color('info') + ->tooltip(fn($record) => $record->home_id) ->sortable() ->searchable(), TextColumn::make('away.ss_team_name')->color('success') + ->tooltip(fn($record) => $record->away_id) ->sortable() ->searchable(), TextColumn::make('starttime')->dateTime('Y-m-d H:i') diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index e4012cc8..d81f26f6 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -2,6 +2,7 @@ namespace App\Filament\Pages; +use App\Actions\LoadSofaScoreCategory; use App\Actions\LoadStatisticFixturesLeaguesOptions; use App\Actions\LoadStatisticFixturesMatchOptions; use App\Filament\Pages\Selections\LoadPlayer; @@ -15,7 +16,6 @@ use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\Radio; use Filament\Forms\Components\Select; use Filament\Forms\Components\Slider; -use Filament\Forms\Components\ToggleButtons; use Filament\Pages\Dashboard as BaseDashboard; use Filament\Pages\Dashboard\Concerns\HasFiltersForm; use Filament\Schemas\Components\Grid; @@ -79,17 +79,33 @@ class Statistic extends BaseDashboard Grid::make([ 'default' => 1, 'sm' => 3, - 'md' => 4, + 'md' => 5, ]) ->columnSpanFull() ->schema([ + Select::make('sofascore_category_id') + ->live() + ->searchable() + ->prefixIconColor(fn(Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger') + ->prefixIcon('phosphor-globe-fill') + ->hiddenLabel() + ->options(fn() => LoadSofaScoreCategory::load()) + ->placeholder('Country') + ->afterStateUpdated(function (callable $set) { + $set('league_id', null); + $set('match_id', null); + $set('team_id', null); + $set('ss_player_id', null); + $set('season', null); + }), Select::make('league_id') ->live() ->searchable() ->prefixIconColor(fn(Get $get): string => $get('league_id') ? 'success' : 'danger') ->prefixIcon('phosphor-trophy-fill') ->hiddenLabel() - ->options(fn() => LoadStatisticFixturesLeaguesOptions::load(1)) + // ->options(fn(Get $get) => SofaScoreTournament::with('sofascore_category')->where('sofa_score_category_id', $get('sofascore_category_id'))->pluck('name', 'tournament_id')) + ->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id'))) ->placeholder('League') ->afterStateUpdated(function (callable $set, $state) { $set('match_id', null); diff --git a/app/Filament/Widgets/Data/LoadEvents.php b/app/Filament/Widgets/Data/LoadEvents.php index 25245e7b..ba028082 100644 --- a/app/Filament/Widgets/Data/LoadEvents.php +++ b/app/Filament/Widgets/Data/LoadEvents.php @@ -248,7 +248,7 @@ class LoadEvents $dataset_away2[] = (int) $value['val_home']; } } - $n = max(count($dataset_home), count($dataset_home2)); + $n = min(count($dataset_home), count($dataset_home2)); $f = array_first($labels); $step = round($f / $n); $labels = []; diff --git a/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php b/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php index d81564e9..5b7d2734 100644 --- a/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php +++ b/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php @@ -86,7 +86,8 @@ class LoadEventsQuery * STATTISTIC DATA */ - $res = StatistikoEvent::with('home')->with('away')->where('league_id', 18) + // dd($league_id, $home_id, $away_id); + $res = StatistikoEvent::with('home')->with('away') ->where(function ($query) use ($league_id, $similar_past_matches) { switch ($similar_past_matches) { case 'none': diff --git a/app/Models/SofaScoreCategory.php b/app/Models/SofaScoreCategory.php index 77668e5d..0fbaa75f 100644 --- a/app/Models/SofaScoreCategory.php +++ b/app/Models/SofaScoreCategory.php @@ -10,11 +10,9 @@ class SofaScoreCategory extends Model 'id', 'name', 'slug', + 'season_mode', + 'flag', + 'in_soccer', 'country_id', ]; - - public function country() - { - return $this->belongsTo(Country::class, 'country_id', 'id'); - } } diff --git a/app/Models/SofaScoreRosa.php b/app/Models/SofaScoreRosa.php index 6140bafa..9e4c2ce4 100644 --- a/app/Models/SofaScoreRosa.php +++ b/app/Models/SofaScoreRosa.php @@ -29,6 +29,11 @@ class SofaScoreRosa extends Model return $this->belongsTo(Country::class); } + public function sofascore_category() + { + return $this->belongsTo(SofaScoreCategory::class, 'country_id', 'country_id')->where('in_soccer', 1); + } + public function tournament_rosa() { return $this->belongsTo(SofaScoreRosaTournament::class, 'ss_team_id', 'ss_team_id'); diff --git a/database/migrations/2026_06_06_135147_create_sofa_score_categories_table.php b/database/migrations/2026_06_06_135147_create_sofa_score_categories_table.php index 13c91ba0..bc0967d1 100644 --- a/database/migrations/2026_06_06_135147_create_sofa_score_categories_table.php +++ b/database/migrations/2026_06_06_135147_create_sofa_score_categories_table.php @@ -15,11 +15,13 @@ return new class extends Migration $table->id(); $table->string('name'); $table->string('slug')->index(); + $table->string('season_mode')->index(); + $table->string('flag')->index(); + $table->boolean('in_soccer')->default(0); $table->integer('country_id')->nullable()->index(); $table->timestamps(); }); } - /** * Reverse the migrations. */ diff --git a/database/seeders/SofaScorePlayerCategorieSeeder.php b/database/seeders/SofaScorePlayerCategorieSeeder.php new file mode 100644 index 00000000..1c87431a --- /dev/null +++ b/database/seeders/SofaScorePlayerCategorieSeeder.php @@ -0,0 +1,297 @@ +