all where to whereDate for starttime

This commit is contained in:
salam committed 2026-02-22 17:08:41 +01:00
1 parent dcaf503b71
commit 831c8507cf
16 files changed
+66 -71

No files matched your search

@@ -205,7 +205,7 @@ class EventsTable
->searchable()
->preload()
->options(function () {
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->whereDate('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
})
@@ -224,9 +224,9 @@ class EventsTable
->searchable()
->options(function (Get $get) {
if ($get('country_id')) {
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->where('country_id', $get('country_id'))->whereDate('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
} else {
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->whereDate('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
}
$arr = [];
foreach ($res as $val) {
@@ -249,9 +249,9 @@ class EventsTable
->searchable()
->options(function (Get $get) {
if ($get('country_id')) {
$res = Event::where('has_markets', 1)->with('country')->where('sport_id', auth()->user()->sport_id)->with('group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
$res = Event::where('has_markets', 1)->with('country')->where('sport_id', auth()->user()->sport_id)->with('group')->where('country_id', $get('country_id'))->whereDate('starttime', '>', Carbon::now())->groupBy('group_id')->get();
} else {
$res = Event::where('has_markets', 1)->with('country')->where('sport_id', auth()->user()->sport_id)->with('group')->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
$res = Event::where('has_markets', 1)->with('country')->where('sport_id', auth()->user()->sport_id)->with('group')->whereDate('starttime', '>', Carbon::now())->groupBy('group_id')->get();
}
$arr = [];
foreach ($res as $val) {
@@ -326,18 +326,18 @@ class EventsTable
$end = Carbon::createFromDate($starttime_period['end']);
return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
->whereDate('starttime', '>=', $from)
->whereDate('starttime', '<=', $end);
} elseif (isset($starttime_period['start'])) {
$from = Carbon::createFromDate($starttime_period['start']);
return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'));
->whereDate('starttime', '>=', $from);
} elseif (isset($starttime_period['end'])) {
$end = Carbon::createFromDate($starttime_period['end']);
return $query
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
->whereDate('starttime', '<=', $end);
}
}
)->when(