all where to whereDate for starttime
This commit is contained in:
1 parent
dcaf503b71
commit
831c8507cf
16 files changed
+66
-71
No files matched your search
@@ -48,7 +48,7 @@ class EventResource extends Resource
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where('starttime', '>', now())
|
||||
->whereDate('starttime', '>', now())
|
||||
->count();
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ class EventResource extends Resource
|
||||
->where('sport_id', auth()->user()->sport_id);
|
||||
|
||||
if (config('env.app_env') == 'production') {
|
||||
$query->where('starttime', '>=', now()->subHour());
|
||||
$query->whereDate('starttime', '>=', now()->subHour());
|
||||
} else {
|
||||
$query->where('starttime', '>=', now());
|
||||
$query->whereDate('starttime', '>=', now());
|
||||
}
|
||||
|
||||
if (auth()->user()->all_only_none > 0) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user