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

+1 -1
View File
@@ -17,7 +17,7 @@ class AlarmStatistic
$events = Event::with('event_bookmaker') $events = Event::with('event_bookmaker')
->where('sport_id', auth()->user()->sport_id) ->where('sport_id', auth()->user()->sport_id)
->where('starttime', '>=', now()) ->whereDate('starttime', '>=', now())
->whereHas('event_bookmaker', function ($query) { ->whereHas('event_bookmaker', function ($query) {
$query->where('bookmaker_id', auth()->user()->bookmaker_id); $query->where('bookmaker_id', auth()->user()->bookmaker_id);
}) })
@@ -25,7 +25,7 @@ class LogifutureColombiaAll
Notice::note(Nuh::$options['name'].' '.Nuh::$options['sport'], 'g'); Notice::note(Nuh::$options['name'].' '.Nuh::$options['sport'], 'g');
} }
$mappers = Mapper::where('provider_id', 2)->where('sport_id', 5)->where('starttime', '>', Carbon::now())->get()->toArray(); $mappers = Mapper::where('provider_id', 2)->where('sport_id', 5)->whereDate('starttime', '>', Carbon::now())->get()->toArray();
foreach ($mappers as $mapper) { foreach ($mappers as $mapper) {
@@ -25,7 +25,7 @@ class LogifutureNigeriaAll
Notice::note(Nuh::$options['name'].' '.Nuh::$options['sport'], 'g'); Notice::note(Nuh::$options['name'].' '.Nuh::$options['sport'], 'g');
} }
$mappers = Mapper::where('provider_id', 2)->where('sport_id', 5)->where('starttime', '>', Carbon::now())->get()->toArray(); $mappers = Mapper::where('provider_id', 2)->where('sport_id', 5)->whereDate('starttime', '>', Carbon::now())->get()->toArray();
foreach ($mappers as $mapper) { foreach ($mappers as $mapper) {
@@ -32,7 +32,7 @@ class MaglooKeniaAll
foreach ($sports as $sport_id) { foreach ($sports as $sport_id) {
$mappers = Mapper::where('provider_id', $provider_id)->where('sport_id', $sport_id)->where('starttime', '>', Carbon::now())->get()->toArray(); $mappers = Mapper::where('provider_id', $provider_id)->where('sport_id', $sport_id)->whereDate('starttime', '>', Carbon::now())->get()->toArray();
foreach ($mappers as $mapper) { foreach ($mappers as $mapper) {
@@ -27,9 +27,8 @@ class MaglooNigeriaAll
} }
$sports = Sport::map('magl'); $sports = Sport::map('magl');
dd($sports);
$mappers = Mapper::where('provider_id', 2)->where('sport_id', 5)->where('starttime', '>', Carbon::now())->get()->toArray(); $mappers = Mapper::where('provider_id', 2)->where('sport_id', 5)->whereDate('starttime', '>', Carbon::now())->get()->toArray();
foreach ($mappers as $mapper) { foreach ($mappers as $mapper) {
@@ -61,12 +61,12 @@ class Bet365
if ($single) { if ($single) {
$events = Event::where('id', Nuh::$options['id'])->where('bet365_id', '>', 0)->select('id', 'sport_id', 'bet365_id', 'starttime')->get(); $events = Event::where('id', Nuh::$options['id'])->where('bet365_id', '>', 0)->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
} elseif ($today) { } elseif ($today) {
$events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDay()->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'starttime')->get(); $events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->whereDate('starttime', '>', Carbon::now())->whereDate('starttime', '<', Carbon::now()->addDay())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
} elseif ($week) { } elseif ($week) {
$events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'starttime')->get(); $events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->whereDate('starttime', '>', Carbon::now())->whereDate('starttime', '<', Carbon::now()->addDays(7))->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
} else { } else {
// all // all
$events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'starttime')->get(); $events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->whereDate('starttime', '>', Carbon::now())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
} }
if ($events ?? null && $debug) { if ($events ?? null && $debug) {
Notice::note('No events', 'r'); Notice::note('No events', 'r');
@@ -24,7 +24,7 @@ class Fixtures
/** /**
* Delete Started * Delete Started
*/ */
$info = Mapper::where('starttime', '<', Carbon::now()->toDateTimeString())->delete(); $info = Mapper::whereDate('starttime', '<', Carbon::now())->delete();
if ($debug) { if ($debug) {
Notice::note("Deleted: $info"); Notice::note("Deleted: $info");
@@ -38,12 +38,12 @@ class Odds
if ($single) { if ($single) {
$events = Event::where('id', Nuh::$options['id'])->where('betsapi_id', '>', 0)->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get(); $events = Event::where('id', Nuh::$options['id'])->where('betsapi_id', '>', 0)->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get();
} elseif ($today) { } elseif ($today) {
$events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDay()->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get(); $events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->whereDate('starttime', '>', Carbon::now())->whereDate('starttime', '<', Carbon::now()->addDay())->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get();
} elseif ($week) { } elseif ($week) {
$events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get(); $events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->whereDate('starttime', '>', Carbon::now())->whereDate('starttime', '<', Carbon::now()->addDays(7))->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get();
} else { } else {
// all // all
$events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get(); $events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->whereDate('starttime', '>', Carbon::now())->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get();
} }
foreach ($events as $key => $event) { foreach ($events as $key => $event) {
@@ -161,8 +161,8 @@ class FindFixture
->where('home_id', $home_id) ->where('home_id', $home_id)
->where('away_id', $away_id) ->where('away_id', $away_id)
->where('competition_group_id', $competition_group_id) ->where('competition_group_id', $competition_group_id)
->where('starttime', '>', $from->toDateTimeString()) ->whereDate('starttime', '>', $from)
->where('starttime', '<', $to->toDateTimeString()) ->whereDate('starttime', '<', $to)
->value('id'); ->value('id');
if ($match_id) { if ($match_id) {
+6 -10
View File
@@ -45,7 +45,7 @@ class Odds
/** /**
* Delete * Delete
*/ */
$info = Event::where('starttime', '<', Carbon::now()->subMinutes(10)->toDateTimeString())->delete(); $info = Event::whereDate('starttime', '<', Carbon::now()->subMinutes(10))->delete();
if ($debug) { if ($debug) {
Notice::note("Deleted: $info"); Notice::note("Deleted: $info");
@@ -126,7 +126,7 @@ class Odds
$from_to = '&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to']; $from_to = '&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to'];
$events = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('group_id', Nuh::$options['gid'])->pluck('id'); $events = Event::whereDate('starttime', '>', Carbon::now())->where('group_id', Nuh::$options['gid'])->pluck('id');
foreach ($events as $event_id) { foreach ($events as $event_id) {
$_calls[] = $url.$markets.$from_to.'&peid='.$event_id; $_calls[] = $url.$markets.$from_to.'&peid='.$event_id;
@@ -142,7 +142,7 @@ class Odds
$from_to = '&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to']; $from_to = '&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to'];
$groupids = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->groupBy('group_id')->pluck('group_id'); $groupids = Event::whereDate('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group_id');
foreach ($groupids as $groupid) { foreach ($groupids as $groupid) {
$_calls[] = $url.$markets.$from_to.'&pgid='.$groupid; $_calls[] = $url.$markets.$from_to.'&pgid='.$groupid;
@@ -158,11 +158,7 @@ class Odds
Notice::note("TODAY \nsport_id: ".Nuh::$options['sport_id'], 'p'); Notice::note("TODAY \nsport_id: ".Nuh::$options['sport_id'], 'p');
} }
$from = Carbon::now()->toDateTimeString(); $res = Event::where('sport_id', Nuh::$options['sport_id'])->whereDate('starttime', '>=', Carbon::now())->whereDate('starttime', '<', Carbon::now()->addDays(1))->pluck('id');
$to = Carbon::now()->addDays(1)->toDateTimeString();
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>=', $from)->where('starttime', '<', $to)->pluck('id');
foreach ($res as $id) { foreach ($res as $id) {
$_calls[] = $url.$sport.$markets.'&peid='.$id; $_calls[] = $url.$sport.$markets.'&peid='.$id;
@@ -178,7 +174,7 @@ class Odds
Notice::note("ONE WEEK FROM NOW \nsport_id: ".Nuh::$options['sport_id'], 'p'); Notice::note("ONE WEEK FROM NOW \nsport_id: ".Nuh::$options['sport_id'], 'p');
} }
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('id'); $res = Event::where('sport_id', Nuh::$options['sport_id'])->whereDate('starttime', '>', Carbon::now())->whereDate('starttime', '<', Carbon::now()->addDays(7))->pluck('id');
foreach ($res as $id) { foreach ($res as $id) {
$_calls[] = $url.$sport.$markets.'&peid='.$id; $_calls[] = $url.$sport.$markets.'&peid='.$id;
@@ -194,7 +190,7 @@ class Odds
Notice::note("ALL \nsport_id: ".Nuh::$options['sport_id'], 'p'); Notice::note("ALL \nsport_id: ".Nuh::$options['sport_id'], 'p');
} }
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('id'); $res = Event::where('sport_id', Nuh::$options['sport_id'])->whereDate('starttime', '>', Carbon::now())->pluck('id');
foreach ($res as $id) { foreach ($res as $id) {
$_calls[] = $url.$sport.$markets.'&peid='.$id; $_calls[] = $url.$sport.$markets.'&peid='.$id;
@@ -48,7 +48,7 @@ class EventResource extends Resource
{ {
return parent::getEloquentQuery() return parent::getEloquentQuery()
->where('sport_id', auth()->user()->sport_id) ->where('sport_id', auth()->user()->sport_id)
->where('starttime', '>', now()) ->whereDate('starttime', '>', now())
->count(); ->count();
} }
@@ -66,9 +66,9 @@ class EventResource extends Resource
->where('sport_id', auth()->user()->sport_id); ->where('sport_id', auth()->user()->sport_id);
if (config('env.app_env') == 'production') { if (config('env.app_env') == 'production') {
$query->where('starttime', '>=', now()->subHour()); $query->whereDate('starttime', '>=', now()->subHour());
} else { } else {
$query->where('starttime', '>=', now()); $query->whereDate('starttime', '>=', now());
} }
if (auth()->user()->all_only_none > 0) { if (auth()->user()->all_only_none > 0) {
@@ -205,7 +205,7 @@ class EventsTable
->searchable() ->searchable()
->preload() ->preload()
->options(function () { ->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'); return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
}) })
@@ -224,9 +224,9 @@ class EventsTable
->searchable() ->searchable()
->options(function (Get $get) { ->options(function (Get $get) {
if ($get('country_id')) { 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 { } 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 = []; $arr = [];
foreach ($res as $val) { foreach ($res as $val) {
@@ -249,9 +249,9 @@ class EventsTable
->searchable() ->searchable()
->options(function (Get $get) { ->options(function (Get $get) {
if ($get('country_id')) { 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 { } 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 = []; $arr = [];
foreach ($res as $val) { foreach ($res as $val) {
@@ -326,18 +326,18 @@ class EventsTable
$end = Carbon::createFromDate($starttime_period['end']); $end = Carbon::createFromDate($starttime_period['end']);
return $query return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')) ->whereDate('starttime', '>=', $from)
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); ->whereDate('starttime', '<=', $end);
} elseif (isset($starttime_period['start'])) { } elseif (isset($starttime_period['start'])) {
$from = Carbon::createFromDate($starttime_period['start']); $from = Carbon::createFromDate($starttime_period['start']);
return $query return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); ->whereDate('starttime', '>=', $from);
} elseif (isset($starttime_period['end'])) { } elseif (isset($starttime_period['end'])) {
$end = Carbon::createFromDate($starttime_period['end']); $end = Carbon::createFromDate($starttime_period['end']);
return $query return $query
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); ->whereDate('starttime', '<=', $end);
} }
} }
)->when( )->when(
+2 -2
View File
@@ -22,7 +22,7 @@ class LoadEvents
->with('home') ->with('home')
->with('away') ->with('away')
->where('sport_id', auth()->user()->sport_id) ->where('sport_id', auth()->user()->sport_id)
->where('starttime', '>', Carbon::now()) ->whereDate('starttime', '>', Carbon::now())
->where(function ($query) use ($element_ids) { ->where(function ($query) use ($element_ids) {
$query->orWhereIn('home_id', $element_ids)->orWhereIn('away_id', $element_ids); $query->orWhereIn('home_id', $element_ids)->orWhereIn('away_id', $element_ids);
}); });
@@ -31,7 +31,7 @@ class LoadEvents
->with('home') ->with('home')
->with('away') ->with('away')
->where('sport_id', auth()->user()->sport_id) ->where('sport_id', auth()->user()->sport_id)
->where('starttime', '>', Carbon::now()); ->whereDate('starttime', '>', Carbon::now());
} }
switch (Auth::user()->provider_id) { switch (Auth::user()->provider_id) {
+2 -2
View File
@@ -19,7 +19,7 @@ class LoadProvider
if (is_array($search_values) and \count($search_values)) { if (is_array($search_values) and \count($search_values)) {
return Mapper::query() return Mapper::query()
->where('starttime', '>', Carbon::now()) ->whereDate('starttime', '>', Carbon::now())
->where('sport_id', $user->sport_id) ->where('sport_id', $user->sport_id)
->where('provider_id', $user->provider_id) ->where('provider_id', $user->provider_id)
->where(function ($query) use ($search_values) { ->where(function ($query) use ($search_values) {
@@ -31,7 +31,7 @@ class LoadProvider
} else { } else {
return Mapper::query() return Mapper::query()
->where('starttime', '>', Carbon::now()) ->whereDate('starttime', '>', Carbon::now())
->where('sport_id', $user->sport_id) ->where('sport_id', $user->sport_id)
->where('provider_id', $user->provider_id); ->where('provider_id', $user->provider_id);
} }
+12 -12
View File
@@ -113,7 +113,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->searchable() ->searchable()
->preload() ->preload()
->options(function (Get $get) { ->options(function (Get $get) {
$query = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id'); $query = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->whereDate('starttime', '>', Carbon::now())->groupBy('country_id');
$timeframe = $get('starttime_period') ?? []; $timeframe = $get('starttime_period') ?? [];
@@ -122,15 +122,15 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from)->whereDate('starttime', '<=', $end);
} elseif (isset($timeframe['start'])) { } elseif (isset($timeframe['start'])) {
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from);
} elseif (isset($timeframe['end'])) { } elseif (isset($timeframe['end'])) {
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '<=', $end);
} }
} }
@@ -151,7 +151,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
$query = CompetitionGroup::where('sport_id', auth()->user()->sport_id) $query = CompetitionGroup::where('sport_id', auth()->user()->sport_id)
->whereHas('event', function ($query) { ->whereHas('event', function ($query) {
$query->where('starttime', '>', now()) $query->whereDate('starttime', '>', now())
->where('betradar_id', 0); ->where('betradar_id', 0);
}); });
@@ -167,15 +167,15 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from)->whereDate('starttime', '<=', $end);
} elseif (isset($timeframe['start'])) { } elseif (isset($timeframe['start'])) {
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from);
} elseif (isset($timeframe['end'])) { } elseif (isset($timeframe['end'])) {
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '<=', $end);
} }
}); });
} }
@@ -231,18 +231,18 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
$end = Carbon::createFromDate($starttime_period['end']); $end = Carbon::createFromDate($starttime_period['end']);
return $query return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')) ->whereDate('starttime', '>=', $from)
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); ->whereDate('starttime', '<=', $end);
} elseif (isset($starttime_period['start'])) { } elseif (isset($starttime_period['start'])) {
$from = Carbon::createFromDate($starttime_period['start']); $from = Carbon::createFromDate($starttime_period['start']);
return $query return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); ->whereDate('starttime', '>=', $from);
} elseif (isset($starttime_period['end'])) { } elseif (isset($starttime_period['end'])) {
$end = Carbon::createFromDate($starttime_period['end']); $end = Carbon::createFromDate($starttime_period['end']);
return $query return $query
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); ->whereDate('starttime', '<=', $end);
} }
}); });
})->indicateUsing(function (): array { })->indicateUsing(function (): array {
+18 -18
View File
@@ -110,7 +110,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->preload() ->preload()
->live() ->live()
->options(function (Get $get) { ->options(function (Get $get) {
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->orderBy('country'); $query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->whereDate('starttime', '>', Carbon::now())->groupBy('country_id')->orderBy('country');
$timeframe = $get('starttime_period') ?? []; $timeframe = $get('starttime_period') ?? [];
if ($timeframe['start'] || $timeframe['end']) { if ($timeframe['start'] || $timeframe['end']) {
@@ -118,15 +118,15 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from)->whereDate('starttime', '<=', $end);
} elseif (isset($timeframe['start'])) { } elseif (isset($timeframe['start'])) {
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from);
} elseif (isset($timeframe['end'])) { } elseif (isset($timeframe['end'])) {
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '<=', $end);
} }
} }
@@ -145,7 +145,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->preload() ->preload()
->live() ->live()
->options(function (Get $get) { ->options(function (Get $get) {
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_cc'); $query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->whereDate('starttime', '>', Carbon::now())->groupBy('group_cc');
$timeframe = $get('starttime_period') ?? []; $timeframe = $get('starttime_period') ?? [];
@@ -154,15 +154,15 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from)->whereDate('starttime', '<=', $end);
} elseif (isset($timeframe['start'])) { } elseif (isset($timeframe['start'])) {
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from);
} elseif (isset($timeframe['end'])) { } elseif (isset($timeframe['end'])) {
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '<=', $end);
} }
} }
if ($get('country_id') ?? null) { if ($get('country_id') ?? null) {
@@ -187,11 +187,11 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->preload() ->preload()
->options(function (Get $get) { ->options(function (Get $get) {
if ($get('country_id')) { if ($get('country_id')) {
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->where('country_id', $get('country_id'))->groupBy('group_id'); $query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->whereDate('starttime', '>', Carbon::now())->where('country_id', $get('country_id'))->groupBy('group_id');
} elseif ($get('group_cc')) { } elseif ($get('group_cc')) {
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->where('group_cc', $get('group_cc'))->groupBy('group_id'); $query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->whereDate('starttime', '>', Carbon::now())->where('group_cc', $get('group_cc'))->groupBy('group_id');
} else { } else {
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id'); $query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->whereDate('starttime', '>', Carbon::now())->groupBy('group_id');
} }
$timeframe = $get('starttime_period') ?? []; $timeframe = $get('starttime_period') ?? [];
@@ -200,15 +200,15 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from)->whereDate('starttime', '<=', $end);
} elseif (isset($timeframe['start'])) { } elseif (isset($timeframe['start'])) {
$from = Carbon::createFromDate($timeframe['start']); $from = Carbon::createFromDate($timeframe['start']);
$query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '>=', $from);
} elseif (isset($timeframe['end'])) { } elseif (isset($timeframe['end'])) {
$end = Carbon::createFromDate($timeframe['end']); $end = Carbon::createFromDate($timeframe['end']);
$query->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); $query->whereDate('starttime', '<=', $end);
} }
} }
@@ -250,18 +250,18 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
$end = Carbon::createFromDate($starttime_period['end']); $end = Carbon::createFromDate($starttime_period['end']);
return $query return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')) ->whereDate('starttime', '>=', $from)
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); ->whereDate('starttime', '<=', $end);
} elseif (isset($starttime_period['start'])) { } elseif (isset($starttime_period['start'])) {
$from = Carbon::createFromDate($starttime_period['start']); $from = Carbon::createFromDate($starttime_period['start']);
return $query return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); ->whereDate('starttime', '>=', $from);
} elseif (isset($starttime_period['end'])) { } elseif (isset($starttime_period['end'])) {
$end = Carbon::createFromDate($starttime_period['end']); $end = Carbon::createFromDate($starttime_period['end']);
return $query return $query
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00')); ->whereDate('starttime', '<=', $end);
} }
}); });
})->indicateUsing(function (): array { })->indicateUsing(function (): array {