This commit is contained in:
salam committed 2026-08-25 08:03:22 +02:00
1 parent d316d486b9
commit c6c5cdc1b1
21 files changed
+620 -34

No files matched your search

@@ -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');
}
}