wip sudamerica comppa e ueva coppas

This commit is contained in:
salam committed 2026-10-22 17:16:48 +02:00
1 parent b20fcb0034
commit 54bbb420ec
5 files changed
+13 -4

No files matched your search

+2
View File
@@ -4,12 +4,14 @@ namespace App\Actions;
use App\Models\SofaScoreTournament; use App\Models\SofaScoreTournament;
use App\Models\StatisticFixtures; use App\Models\StatisticFixtures;
use Illuminate\Support\Carbon;
class LoadSofaScoreCategory class LoadSofaScoreCategory
{ {
public static function load() public static function load()
{ {
$league_ids = StatisticFixtures::where('sport_id', 1) $league_ids = StatisticFixtures::where('sport_id', 1)
->where('starttime', '>=', Carbon::now())
->groupBy('league_id') ->groupBy('league_id')
->pluck('league_id')->toArray(); ->pluck('league_id')->toArray();
@@ -3,12 +3,14 @@
namespace App\Actions; namespace App\Actions;
use App\Models\StatisticFixtures; use App\Models\StatisticFixtures;
use Illuminate\Support\Carbon;
class LoadStatisticFixturesLeaguesOptions class LoadStatisticFixturesLeaguesOptions
{ {
public static function load(?int $sofascore_category_id = 0) public static function load(?int $sofascore_category_id = 0)
{ {
$res = StatisticFixtures::with('league') $res = StatisticFixtures::with('league')
->where('starttime', '>=', Carbon::now())
->whereHas('league', function ($query) use ($sofascore_category_id) { ->whereHas('league', function ($query) use ($sofascore_category_id) {
$query->where('sofa_score_category_id', $sofascore_category_id); $query->where('sofa_score_category_id', $sofascore_category_id);
}) })
@@ -4,6 +4,7 @@ namespace App\Actions;
use App\Models\SofaScoreRosa; use App\Models\SofaScoreRosa;
use App\Models\StatisticFixtures; use App\Models\StatisticFixtures;
use Illuminate\Support\Carbon;
class LoadStatisticFixturesMatchOptions class LoadStatisticFixturesMatchOptions
{ {
@@ -14,12 +15,16 @@ class LoadStatisticFixturesMatchOptions
} }
$team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray(); $team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray();
$res = StatisticFixtures::where('league_id', $league_id)->get(); $res = StatisticFixtures::where('league_id', $league_id)
->where('starttime', '>=', Carbon::now())
->get();
$arr = []; $arr = [];
foreach ($res as $val) { foreach ($res as $val) {
if (isset($team_map[$val->home_id]) && isset($team_map[$val->away_id])) {
$arr[$val->id] = $val->starttime->format('Y-m-d H:i').' - '.$team_map[$val->home_id].' vs '.$team_map[$val->away_id]; $arr[$val->id] = $val->starttime->format('Y-m-d H:i').' - '.$team_map[$val->home_id].' vs '.$team_map[$val->away_id];
} }
}
return $arr; return $arr;
} }
@@ -10,12 +10,11 @@ class Expectation1X2
public static function load(array &$expectations, array $filter, object $match) public static function load(array &$expectations, array $filter, object $match)
{ {
$team_id = (int) $filter['team_id'] ?? 0; $team_id = (int) $filter['team_id'] ?? 0;
$home_id = $match->home_id;
$away_id = $match->away_id;
$res_tp = LoadEventsQueryTP::load($filter, $match); $res_tp = LoadEventsQueryTP::load($filter, $match);
$count_tp = $res_tp->count(); $count_tp = $res_tp->count();
$expectations['count_events'] = $count_tp; $expectations['count_events'] = $count_tp;
$expectations += ['win_count' => 0, 'draw_count' => 0, 'lost_count' => 0]; $expectations += ['win_count' => 0, 'draw_count' => 0, 'lost_count' => 0];
@@ -5,6 +5,7 @@ namespace App\Filament\Widgets\Charts\LoadEvents;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
use App\Models\StatistikoPlayer; use App\Models\StatistikoPlayer;
use Illuminate\Support\Facades\Log;
class LoadEventsQueryTP class LoadEventsQueryTP
{ {
@@ -97,7 +98,7 @@ class LoadEventsQueryTP
/** /**
* STATTISTIC DATA * STATTISTIC DATA
*/ */
// Log::debug('result', [$similar_past_matches, $home_id, $away_id, $team_id]); Log::debug('result', [$similar_past_matches, $league_id, $team_id]);
return StatistikoEvent::with('home')->with('away') return StatistikoEvent::with('home')->with('away')
->where(function ($query) use ($league_id, $similar_past_matches) { ->where(function ($query) use ($league_id, $similar_past_matches) {