This commit is contained in:
salam committed 2026-08-25 08:03:22 +02:00
1 parent d316d486b9
commit c6c5cdc1b1
21 files changed
+620 -34

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Actions;
use App\Models\SofaScoreCategory;
use App\Models\SofaScoreTournament;
use App\Models\StatisticFixtures;
class LoadSofaScoreCategory
{
public static function load()
{
$league_ids = StatisticFixtures::where('sport_id', 1)
->groupBy('league_id')
->pluck('league_id')->toArray();
$sofa_score_category_id = SofaScoreTournament::whereIn('tournament_id', $league_ids)->pluck('sofa_score_category_id')->toArray();
$sofa_score_category_id = array_unique($sofa_score_category_id);
return SofaScoreCategory::where('in_soccer', 1)->whereIn('id', $sofa_score_category_id)->orderBy('name')->pluck('name', 'id');
}
}
@@ -3,24 +3,15 @@
namespace App\Actions;
use App\Models\SofaScoreTournament;
use App\Models\StatisticFixtures;
class LoadStatisticFixturesLeaguesOptions
{
public static function load(int $sport_id)
public static function load(int|null $sofascore_category_id = 0)
{
$res = StatisticFixtures::where('sport_id', $sport_id)
->groupBy('league_id')
->pluck('league_id')->toArray();
// $res = StatisticFixtures::with('league')->where('league_id', $sofascore_category_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;
return SofaScoreTournament::where('enabled', 1)->where('sofa_score_category_id', $sofascore_category_id)->orderBy('name')->pluck('name', 'tournament_id');
}
}