wip
This commit is contained in:
1 parent
8a5446db7f
commit
67322ec35b
1 file changed
+14
-17
+14
-17
@@ -153,27 +153,24 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
$timeframe = $get('starttime_period') ?? null;
|
$timeframe = $get('starttime_period') ?? null;
|
||||||
|
|
||||||
if ($timeframe['start'] || $timeframe['end']) {
|
if ($timeframe['start'] || $timeframe['end']) {
|
||||||
$query = Event::query()->where('sport_id', auth()->user()->sport_id);
|
$query->whereHas('event', function ($query) {
|
||||||
if (isset($timeframe['start']) && isset($timeframe['end'])) {
|
if (isset($timeframe['start']) && isset($timeframe['end'])) {
|
||||||
$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->format('Y-m-d 00:00:00'))->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
|
||||||
} 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->format('Y-m-d 00:00:00'));
|
||||||
} 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->format('Y-m-d 00:00:00'));
|
||||||
}
|
}
|
||||||
$countries = $query->pluck('country_id')->toArray();
|
});
|
||||||
|
|
||||||
$res = $query->groupBy('country_id')->whereIn('country_id', $countries)->get();
|
|
||||||
} else {
|
|
||||||
$res = $query->get();
|
|
||||||
}
|
}
|
||||||
|
$res = $query->groupBy('country_id')->get();
|
||||||
}
|
}
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $value) {
|
foreach ($res as $value) {
|
||||||
|
|||||||
Reference in new issue
Block a user