fumetto max ok
This commit is contained in:
1 parent
9e7384daf8
commit
9c78f507f4
58 files changed
+672
-144
No files matched your search
@@ -49,7 +49,26 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
->filters([
|
||||
Filter::make('events')
|
||||
->schema([
|
||||
Select::make('country_id')
|
||||
->visible(fn () => in_array(Auth()->user()->provider_id, [3, 4]))
|
||||
->placeholder('Country')
|
||||
->hiddenLabel()
|
||||
->label('')
|
||||
->searchable()
|
||||
->preload()
|
||||
->multiple()
|
||||
->columnSpan(2)
|
||||
->live()
|
||||
->options(function () {
|
||||
return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country', 'country_id')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('group_id', null);
|
||||
})
|
||||
->placeholder('Country'),
|
||||
Select::make('group_cc')
|
||||
->visible(fn () => Auth()->user()->provider_id == 2)
|
||||
->placeholder('Country')
|
||||
->hiddenLabel()
|
||||
->label('')
|
||||
@@ -67,8 +86,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('group_id', null);
|
||||
})
|
||||
->placeholder('Country')
|
||||
->label('Countries'),
|
||||
->placeholder('Country'),
|
||||
Select::make('group_id')
|
||||
->placeholder('League')
|
||||
->label('Leagues')
|
||||
@@ -79,7 +97,9 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
->preload()
|
||||
->multiple()
|
||||
->options(function (Get $get) {
|
||||
if ($get('group_cc')) {
|
||||
if ($get('country_id')) {
|
||||
return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
} elseif ($get('group_cc')) {
|
||||
return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->whereIn('group_cc', $get('group_cc'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
} else {
|
||||
return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
@@ -90,6 +110,9 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['country_id'],
|
||||
fn (Builder $query, $country_id) => $query->whereIn('country_id', $country_id)
|
||||
)->when(
|
||||
$data['group_cc'],
|
||||
fn (Builder $query, $group_cc) => $query->whereIn('group_cc', $group_cc)
|
||||
)->when(
|
||||
|
||||
Reference in new issue
Block a user