Files
nuhodds_fi4/app/Actions/LoadStatisticFixturesLeaguesOptions.php
T
2026-07-30 18:57:44 +02:00

27 lines
651 B
PHP

<?php
namespace App\Actions;
use App\Models\SofaScoreTournament;
use App\Models\StatisticFixtures;
class LoadStatisticFixturesLeaguesOptions
{
public static function load(int $sport_id)
{
$res = StatisticFixtures::where('sport_id', $sport_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;
}
}