sql fixes
This commit is contained in:
1 parent
feb9070e5a
commit
1905440212
2 files changed
+34
-18
No files matched your search
@@ -206,6 +206,19 @@ class EventsTable
|
|||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('competition_group_id', null);
|
$set('competition_group_id', null);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
Select::make('client_group_list_id')
|
||||||
|
->placeholder('Custom Groups')
|
||||||
|
->prefixIcon('phosphor-user-list')
|
||||||
|
->searchable()
|
||||||
|
->hiddenLabel()
|
||||||
|
->label('')
|
||||||
|
->preload()
|
||||||
|
->options(fn () => ClientGroupList::where('sport_id', auth()->user()->sport_id)
|
||||||
|
->where('client_id', auth()->user()->client_id)
|
||||||
|
->pluck('name', 'id'))
|
||||||
|
->live(),
|
||||||
|
|
||||||
Select::make('competition_group_id')
|
Select::make('competition_group_id')
|
||||||
->placeholder('League')
|
->placeholder('League')
|
||||||
->prefixIcon('phosphor-trophy')
|
->prefixIcon('phosphor-trophy')
|
||||||
@@ -214,7 +227,18 @@ class EventsTable
|
|||||||
->multiple()
|
->multiple()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
if ($get('country_id')) {
|
if ($get('client_group_list_id')) {
|
||||||
|
|
||||||
|
$list = ClientGroupList::where('id', $get('client_group_list_id'))->value('client_groups');
|
||||||
|
|
||||||
|
$res = Event::where('has_markets', 1)
|
||||||
|
->with('country')
|
||||||
|
->with('competition_group')
|
||||||
|
->where('sport_id', auth()->user()->sport_id)
|
||||||
|
->where('starttime', '>', Carbon::now())
|
||||||
|
->whereIn('competition_group_id', $list)
|
||||||
|
->get();
|
||||||
|
} elseif ($get('country_id')) {
|
||||||
$res = Event::where('has_markets', 1)
|
$res = Event::where('has_markets', 1)
|
||||||
->with('country')
|
->with('country')
|
||||||
->with('competition_group')
|
->with('competition_group')
|
||||||
@@ -240,6 +264,7 @@ class EventsTable
|
|||||||
return $arr;
|
return $arr;
|
||||||
})
|
})
|
||||||
->live(),
|
->live(),
|
||||||
|
|
||||||
Select::make('competition_group_id')
|
Select::make('competition_group_id')
|
||||||
->visible(fn () => auth()->user()->sport_id == 5)
|
->visible(fn () => auth()->user()->sport_id == 5)
|
||||||
->placeholder('Tournament')
|
->placeholder('Tournament')
|
||||||
@@ -254,28 +279,19 @@ class EventsTable
|
|||||||
->with('competition_group')
|
->with('competition_group')
|
||||||
->where('sport_id', auth()->user()->sport_id)
|
->where('sport_id', auth()->user()->sport_id)
|
||||||
->where('starttime', '>', Carbon::now())
|
->where('starttime', '>', Carbon::now())
|
||||||
->groupBy('competition_group_id')
|
// ->groupBy('competition_group_id')
|
||||||
->get();
|
->get();
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $val) {
|
foreach ($res as $val) {
|
||||||
|
if (! isset($arr[$val->competition_group_id])) {
|
||||||
$arr[$val->competition_group_id] = $val->competition_group->name;
|
$arr[$val->competition_group_id] = $val->competition_group->name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
asort($arr);
|
asort($arr);
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
})
|
})
|
||||||
->live(),
|
->live(),
|
||||||
Select::make('client_group_list_id')
|
|
||||||
->placeholder('Custom Groups')
|
|
||||||
->prefixIcon('phosphor-user-list')
|
|
||||||
->searchable()
|
|
||||||
->hiddenLabel()
|
|
||||||
->label('')
|
|
||||||
->preload()
|
|
||||||
->options(fn() => ClientGroupList::where('sport_id', auth()->user()->sport_id)
|
|
||||||
->where('client_id', auth()->user()->client_id)
|
|
||||||
->pluck('name', 'id'))
|
|
||||||
->live(),
|
|
||||||
|
|
||||||
DateRangePicker::make('starttime_period')
|
DateRangePicker::make('starttime_period')
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
|
|||||||
@@ -113,7 +113,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)->groupBy('country_id')->orderBy('country');
|
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id);
|
||||||
|
|
||||||
$timeframe = $get('starttime_period') ?? [];
|
$timeframe = $get('starttime_period') ?? [];
|
||||||
if ($timeframe['start'] || $timeframe['end']) {
|
if ($timeframe['start'] || $timeframe['end']) {
|
||||||
@@ -148,7 +148,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)->groupBy('group_cc');
|
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id);
|
||||||
|
|
||||||
$timeframe = $get('starttime_period') ?? [];
|
$timeframe = $get('starttime_period') ?? [];
|
||||||
|
|
||||||
@@ -190,11 +190,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('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)->where('country_id', $get('country_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('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)->where('group_cc', $get('group_cc'));
|
||||||
} else {
|
} else {
|
||||||
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->groupBy('group_id');
|
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$timeframe = $get('starttime_period') ?? [];
|
$timeframe = $get('starttime_period') ?? [];
|
||||||
|
|||||||
Reference in new issue
Block a user