From 2545542033f18b2ddc9638a30a2bf73da50f1558 Mon Sep 17 00:00:00 2001 From: salam Date: Fri, 16 Oct 2026 16:59:36 +0200 Subject: [PATCH] wip --- .../Tables/SofaScoreTournamentsTable.php | 26 +++++++++++++++++++ app/Traits/Sofascore/GrappingTeams.php | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php index 59d149b4..a7eacb93 100644 --- a/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php @@ -2,7 +2,12 @@ namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Tables; +use App\Models\SofaScoreRosa; +use App\Models\SofaScoreRosaTournament; +use App\Models\SofaScoreTournament; +use Filament\Actions\Action; use Filament\Forms\Components\Toggle; +use Filament\Notifications\Notification; use Filament\Support\Enums\IconSize; use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\TextColumn; @@ -18,6 +23,27 @@ class SofaScoreTournamentsTable public static function configure(Table $table): Table { return $table + ->headerActions([ + Action::make('update_rose_tornaments') + ->label('Update Roosters') + ->action(function () { + $res = SofaScoreTournament::whereNotNull('ss_liga_code')->where('ss_liga_code', '<>', '')->where('enabled', 1)->pluck('ss_liga_code', 'tournament_id'); + foreach ($res as $tournament_id => $ss_liga_code) { + $rosa = SofaScoreRosa::where('cc', $ss_liga_code)->get(); + foreach ($rosa as $team) { + SofaScoreRosaTournament::updateOrCreate( + ['ss_team_id' => $team->ss_team_id, 'ss_tournament_id' => $tournament_id], + ['grapped' => 0, 'disabled' => 0] + ); + } + } + }) + ->successNotification( + Notification::make() + ->success() + ->title('Tournament Roosters table updated') + ), + ]) ->columns([ IconColumn::make('sport.icon') ->label('') diff --git a/app/Traits/Sofascore/GrappingTeams.php b/app/Traits/Sofascore/GrappingTeams.php index 0f8d35ba..62af5e9e 100644 --- a/app/Traits/Sofascore/GrappingTeams.php +++ b/app/Traits/Sofascore/GrappingTeams.php @@ -69,7 +69,7 @@ trait GrappingTeams if ($this->debug) { $key++; - Notice::note($key / $count.' - '.$value->ss_team_name); + Notice::note($key.'/'.$count.' - '.$value->ss_team_name); } $url = $this->base_url."api/v1/team/$value->ss_team_id/players";