28 lines
690 B
PHP
28 lines
690 B
PHP
<?php
|
|
|
|
namespace App\Actions;
|
|
|
|
use App\Models\StatisticFixtures;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class LoadStatisticFixturesLeaguesOptions
|
|
{
|
|
public static function load(?int $sofascore_category_id = 0)
|
|
{
|
|
$res = StatisticFixtures::with('league')
|
|
->where('starttime', '>=', Carbon::now())
|
|
->whereHas('league', function ($query) use ($sofascore_category_id) {
|
|
$query->where('sofa_score_category_id', $sofascore_category_id);
|
|
})
|
|
->get();
|
|
|
|
$arr = [];
|
|
foreach ($res as $value) {
|
|
$arr[$value->league_id] = $value->league->name;
|
|
}
|
|
asort($arr);
|
|
|
|
return $arr;
|
|
}
|
|
}
|