27 lines
601 B
PHP
27 lines
601 B
PHP
<?php
|
|
|
|
namespace App\Actions;
|
|
|
|
use App\Models\CompetitionGroup;
|
|
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 = CompetitionGroup::with('country')->whereIn('id', $res)->get();
|
|
$arr = [];
|
|
foreach ($cnt as $val) {
|
|
$arr[$val->id] = $val->country->name . ' ' . $val->name;
|
|
}
|
|
|
|
asort($arr);
|
|
|
|
return $arr;
|
|
}
|
|
}
|