db and query optimization compl
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user