From 831c8507cf4847339484676ac4974b4d682b0a80 Mon Sep 17 00:00:00 2001 From: salam Date: Sun, 22 Feb 2026 17:08:41 +0100 Subject: [PATCH] all where to whereDate for starttime --- app/Actions/AlarmStatistic.php | 2 +- .../DbMapper/LogifutureColombiaAll.php | 2 +- .../DbMapper/LogifutureNigeriaAll.php | 2 +- .../Commands/DbMapper/MaglooKeniaAll.php | 2 +- .../Commands/DbMapper/MaglooNigeriaAll.php | 3 +- .../Commands/Grapper/Betsapi/Bet365.php | 6 ++-- .../Commands/Grapper/Betsapi/Fixtures.php | 2 +- app/Console/Commands/Grapper/Betsapi/Odds.php | 6 ++-- .../Commands/Grapper/Fixtures/FindFixture.php | 4 +-- app/Console/Commands/Grapper/TxOdds/Odds.php | 16 ++++----- .../Resources/Events/EventResource.php | 6 ++-- .../Resources/Events/Tables/EventsTable.php | 18 +++++----- app/Livewire/Mapper/LoadEvents.php | 4 +-- app/Livewire/Mapper/LoadProvider.php | 4 +-- app/Livewire/MapperLeft.php | 24 ++++++------- app/Livewire/MapperRight.php | 36 +++++++++---------- 16 files changed, 66 insertions(+), 71 deletions(-) diff --git a/app/Actions/AlarmStatistic.php b/app/Actions/AlarmStatistic.php index c8496afc..cbfd7e24 100644 --- a/app/Actions/AlarmStatistic.php +++ b/app/Actions/AlarmStatistic.php @@ -17,7 +17,7 @@ class AlarmStatistic $events = Event::with('event_bookmaker') ->where('sport_id', auth()->user()->sport_id) - ->where('starttime', '>=', now()) + ->whereDate('starttime', '>=', now()) ->whereHas('event_bookmaker', function ($query) { $query->where('bookmaker_id', auth()->user()->bookmaker_id); }) diff --git a/app/Console/Commands/DbMapper/LogifutureColombiaAll.php b/app/Console/Commands/DbMapper/LogifutureColombiaAll.php index be437c9d..b3ff07e1 100644 --- a/app/Console/Commands/DbMapper/LogifutureColombiaAll.php +++ b/app/Console/Commands/DbMapper/LogifutureColombiaAll.php @@ -25,7 +25,7 @@ class LogifutureColombiaAll 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) { diff --git a/app/Console/Commands/DbMapper/LogifutureNigeriaAll.php b/app/Console/Commands/DbMapper/LogifutureNigeriaAll.php index 7a7bedca..290259fc 100644 --- a/app/Console/Commands/DbMapper/LogifutureNigeriaAll.php +++ b/app/Console/Commands/DbMapper/LogifutureNigeriaAll.php @@ -25,7 +25,7 @@ class LogifutureNigeriaAll 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) { diff --git a/app/Console/Commands/DbMapper/MaglooKeniaAll.php b/app/Console/Commands/DbMapper/MaglooKeniaAll.php index 979c8eb6..f18e8ee3 100644 --- a/app/Console/Commands/DbMapper/MaglooKeniaAll.php +++ b/app/Console/Commands/DbMapper/MaglooKeniaAll.php @@ -32,7 +32,7 @@ class MaglooKeniaAll 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) { diff --git a/app/Console/Commands/DbMapper/MaglooNigeriaAll.php b/app/Console/Commands/DbMapper/MaglooNigeriaAll.php index 7cde5ce7..3635466c 100644 --- a/app/Console/Commands/DbMapper/MaglooNigeriaAll.php +++ b/app/Console/Commands/DbMapper/MaglooNigeriaAll.php @@ -27,9 +27,8 @@ class MaglooNigeriaAll } $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) { diff --git a/app/Console/Commands/Grapper/Betsapi/Bet365.php b/app/Console/Commands/Grapper/Betsapi/Bet365.php index 94e31a68..987c1dfc 100644 --- a/app/Console/Commands/Grapper/Betsapi/Bet365.php +++ b/app/Console/Commands/Grapper/Betsapi/Bet365.php @@ -61,12 +61,12 @@ class Bet365 if ($single) { $events = Event::where('id', Nuh::$options['id'])->where('bet365_id', '>', 0)->select('id', 'sport_id', 'bet365_id', 'starttime')->get(); } 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) { - $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 { // 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) { Notice::note('No events', 'r'); diff --git a/app/Console/Commands/Grapper/Betsapi/Fixtures.php b/app/Console/Commands/Grapper/Betsapi/Fixtures.php index c13f6d46..e769ac33 100644 --- a/app/Console/Commands/Grapper/Betsapi/Fixtures.php +++ b/app/Console/Commands/Grapper/Betsapi/Fixtures.php @@ -24,7 +24,7 @@ class Fixtures /** * Delete Started */ - $info = Mapper::where('starttime', '<', Carbon::now()->toDateTimeString())->delete(); + $info = Mapper::whereDate('starttime', '<', Carbon::now())->delete(); if ($debug) { Notice::note("Deleted: $info"); diff --git a/app/Console/Commands/Grapper/Betsapi/Odds.php b/app/Console/Commands/Grapper/Betsapi/Odds.php index f403ab8f..1725ca14 100644 --- a/app/Console/Commands/Grapper/Betsapi/Odds.php +++ b/app/Console/Commands/Grapper/Betsapi/Odds.php @@ -38,12 +38,12 @@ class Odds if ($single) { $events = Event::where('id', Nuh::$options['id'])->where('betsapi_id', '>', 0)->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get(); } 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) { - $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 { // 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) { diff --git a/app/Console/Commands/Grapper/Fixtures/FindFixture.php b/app/Console/Commands/Grapper/Fixtures/FindFixture.php index 02fce7f8..1223edd7 100644 --- a/app/Console/Commands/Grapper/Fixtures/FindFixture.php +++ b/app/Console/Commands/Grapper/Fixtures/FindFixture.php @@ -161,8 +161,8 @@ class FindFixture ->where('home_id', $home_id) ->where('away_id', $away_id) ->where('competition_group_id', $competition_group_id) - ->where('starttime', '>', $from->toDateTimeString()) - ->where('starttime', '<', $to->toDateTimeString()) + ->whereDate('starttime', '>', $from) + ->whereDate('starttime', '<', $to) ->value('id'); if ($match_id) { diff --git a/app/Console/Commands/Grapper/TxOdds/Odds.php b/app/Console/Commands/Grapper/TxOdds/Odds.php index c4fc7d55..84dda2e6 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds.php @@ -45,7 +45,7 @@ class Odds /** * Delete */ - $info = Event::where('starttime', '<', Carbon::now()->subMinutes(10)->toDateTimeString())->delete(); + $info = Event::whereDate('starttime', '<', Carbon::now()->subMinutes(10))->delete(); if ($debug) { Notice::note("Deleted: $info"); @@ -126,7 +126,7 @@ class Odds $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) { $_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']; - $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) { $_calls[] = $url.$markets.$from_to.'&pgid='.$groupid; @@ -158,11 +158,7 @@ class Odds Notice::note("TODAY \nsport_id: ".Nuh::$options['sport_id'], 'p'); } - $from = Carbon::now()->toDateTimeString(); - - $to = Carbon::now()->addDays(1)->toDateTimeString(); - - $res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>=', $from)->where('starttime', '<', $to)->pluck('id'); + $res = Event::where('sport_id', Nuh::$options['sport_id'])->whereDate('starttime', '>=', Carbon::now())->whereDate('starttime', '<', Carbon::now()->addDays(1))->pluck('id'); foreach ($res as $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'); } - $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) { $_calls[] = $url.$sport.$markets.'&peid='.$id; @@ -194,7 +190,7 @@ class Odds 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) { $_calls[] = $url.$sport.$markets.'&peid='.$id; diff --git a/app/Filament/Resources/Events/EventResource.php b/app/Filament/Resources/Events/EventResource.php index e7d530ff..448c8574 100644 --- a/app/Filament/Resources/Events/EventResource.php +++ b/app/Filament/Resources/Events/EventResource.php @@ -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) { diff --git a/app/Filament/Resources/Events/Tables/EventsTable.php b/app/Filament/Resources/Events/Tables/EventsTable.php index da8a3742..53566fbe 100644 --- a/app/Filament/Resources/Events/Tables/EventsTable.php +++ b/app/Filament/Resources/Events/Tables/EventsTable.php @@ -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( diff --git a/app/Livewire/Mapper/LoadEvents.php b/app/Livewire/Mapper/LoadEvents.php index c25fe3a6..5bae22d0 100644 --- a/app/Livewire/Mapper/LoadEvents.php +++ b/app/Livewire/Mapper/LoadEvents.php @@ -22,7 +22,7 @@ class LoadEvents ->with('home') ->with('away') ->where('sport_id', auth()->user()->sport_id) - ->where('starttime', '>', Carbon::now()) + ->whereDate('starttime', '>', Carbon::now()) ->where(function ($query) use ($element_ids) { $query->orWhereIn('home_id', $element_ids)->orWhereIn('away_id', $element_ids); }); @@ -31,7 +31,7 @@ class LoadEvents ->with('home') ->with('away') ->where('sport_id', auth()->user()->sport_id) - ->where('starttime', '>', Carbon::now()); + ->whereDate('starttime', '>', Carbon::now()); } switch (Auth::user()->provider_id) { diff --git a/app/Livewire/Mapper/LoadProvider.php b/app/Livewire/Mapper/LoadProvider.php index 4ea40ee7..c4e90ea4 100644 --- a/app/Livewire/Mapper/LoadProvider.php +++ b/app/Livewire/Mapper/LoadProvider.php @@ -19,7 +19,7 @@ class LoadProvider if (is_array($search_values) and \count($search_values)) { return Mapper::query() - ->where('starttime', '>', Carbon::now()) + ->whereDate('starttime', '>', Carbon::now()) ->where('sport_id', $user->sport_id) ->where('provider_id', $user->provider_id) ->where(function ($query) use ($search_values) { @@ -31,7 +31,7 @@ class LoadProvider } else { return Mapper::query() - ->where('starttime', '>', Carbon::now()) + ->whereDate('starttime', '>', Carbon::now()) ->where('sport_id', $user->sport_id) ->where('provider_id', $user->provider_id); } diff --git a/app/Livewire/MapperLeft.php b/app/Livewire/MapperLeft.php index 2925a238..2b8dfded 100644 --- a/app/Livewire/MapperLeft.php +++ b/app/Livewire/MapperLeft.php @@ -113,7 +113,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable ->searchable() ->preload() ->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') ?? []; @@ -122,15 +122,15 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable $from = Carbon::createFromDate($timeframe['start']); $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'])) { $from = Carbon::createFromDate($timeframe['start']); - $query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); + $query->whereDate('starttime', '>=', $from); } elseif (isset($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) ->whereHas('event', function ($query) { - $query->where('starttime', '>', now()) + $query->whereDate('starttime', '>', now()) ->where('betradar_id', 0); }); @@ -167,15 +167,15 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable $from = Carbon::createFromDate($timeframe['start']); $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'])) { $from = Carbon::createFromDate($timeframe['start']); - $query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); + $query->whereDate('starttime', '>=', $from); } elseif (isset($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']); 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); } }); })->indicateUsing(function (): array { diff --git a/app/Livewire/MapperRight.php b/app/Livewire/MapperRight.php index 613bf6ff..84f268ba 100644 --- a/app/Livewire/MapperRight.php +++ b/app/Livewire/MapperRight.php @@ -110,7 +110,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable ->preload() ->live() ->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') ?? []; if ($timeframe['start'] || $timeframe['end']) { @@ -118,15 +118,15 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable $from = Carbon::createFromDate($timeframe['start']); $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'])) { $from = Carbon::createFromDate($timeframe['start']); - $query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); + $query->whereDate('starttime', '>=', $from); } elseif (isset($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() ->live() ->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') ?? []; @@ -154,15 +154,15 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable $from = Carbon::createFromDate($timeframe['start']); $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'])) { $from = Carbon::createFromDate($timeframe['start']); - $query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); + $query->whereDate('starttime', '>=', $from); } elseif (isset($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) { @@ -187,11 +187,11 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable ->preload() ->options(function (Get $get) { 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')) { - $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 { - $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') ?? []; @@ -200,15 +200,15 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable $from = Carbon::createFromDate($timeframe['start']); $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'])) { $from = Carbon::createFromDate($timeframe['start']); - $query->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00')); + $query->whereDate('starttime', '>=', $from); } elseif (isset($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']); 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); } }); })->indicateUsing(function (): array {