27 lines
651 B
PHP
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;
|
|
}
|
|
}
|