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
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user