wip
This commit is contained in:
1 parent
b74c374586
commit
1a46e5d887
6 files changed
+60
-18
No files matched your search
@@ -2,16 +2,23 @@
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Models\StatisticFixtures;
|
||||
|
||||
class LoadStatisticFixturesLeaguesOptions
|
||||
{
|
||||
public static function load(int|null $sofascore_category_id = 0)
|
||||
public static function load(?int $sofascore_category_id = 0)
|
||||
{
|
||||
// $res = StatisticFixtures::with('league')->where('league_id', $sofascore_category_id)
|
||||
// ->groupBy('league_id')
|
||||
// ->pluck('league_id')->toArray();
|
||||
$res = StatisticFixtures::with('league')
|
||||
->whereHas('league', function ($query) use ($sofascore_category_id) {
|
||||
$query->where('sofa_score_category_id', $sofascore_category_id);
|
||||
})
|
||||
->get();
|
||||
|
||||
return SofaScoreTournament::where('enabled', 1)->where('sofa_score_category_id', $sofascore_category_id)->orderBy('name')->pluck('name', 'tournament_id');
|
||||
$arr = [];
|
||||
foreach ($res as $value) {
|
||||
$arr[$value->league_id] = $value->league->name;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user