db and query optimization compl

This commit is contained in:
salam committed 2026-01-04 06:29:11 +01:00
1 parent 9d2a8ce628
commit 40d97327d4
24 files changed
+145 -126

No files matched your search

@@ -52,7 +52,31 @@ class EventResource extends Resource
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->where('starttime', '>', Carbon::now());
$query = parent::getEloquentQuery()
->where('starttime', '>', Carbon::now())
->with('competition_group')
->with('country')
->with('home')
->with('away');
if (in_array(1, EventsTable::$bettype_settings)) {
$query->with('odds_3way.bookmaker');
}
if (in_array(2, EventsTable::$bettype_settings)) {
$query->with('odds_dc.bookmaker');
}
if (in_array(3, EventsTable::$bettype_settings)) {
$query->with('odds_dnb.bookmaker');
}
if (in_array(4, EventsTable::$bettype_settings)) {
$query->with('odds_ggng.bookmaker');
}
if (in_array(5, EventsTable::$bettype_settings)) {
$query->with('odds_tq.bookmaker');
}
if (in_array(6, EventsTable::$bettype_settings)) {
$query->with('odds_total.bookmaker');
}
return $query;
}
}