This commit is contained in:
salam committed 2026-10-16 16:59:36 +02:00
1 parent 33e8107517
commit 2545542033
2 files changed
+27 -1

No files matched your search

@@ -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('')