This commit is contained in:
salam committed 2026-02-13 13:38:10 +01:00
1 parent 35a6e605b9
commit 2de7cb1504
1 file changed
+42 -42
+42 -42
View File
@@ -98,51 +98,51 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->columns(4) ->columns(4)
->schema([ ->schema([
FusedGroup::make([ FusedGroup::make([
Select::make('country_id') // Select::make('country_id')
->placeholder('Country') // ->placeholder('Country')
->hiddenLabel() // ->hiddenLabel()
->searchable() // ->searchable()
->preload() // ->preload()
->options(function () { // ->options(function () {
$res = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray(); // $res = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id'); // return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
}) // })
->afterStateUpdated(function (callable $set) { // ->afterStateUpdated(function (callable $set) {
$set('competition_group_id', null); // $set('competition_group_id', null);
}) // })
->live(), // ->live(),
Select::make('competition_group_id') // Select::make('competition_group_id')
->placeholder('League') // ->placeholder('League')
->hiddenLabel() // ->hiddenLabel()
->label('') // ->label('')
->searchable() // ->searchable()
->options(function (Get $get) { // ->options(function (Get $get) {
$map = Country::all()->pluck('name', 'id'); // $map = Country::all()->pluck('name', 'id');
$query = CompetitionGroup::where('sport_id', auth()->user()->sport_id) // $query = CompetitionGroup::where('sport_id', auth()->user()->sport_id)
->whereHas('event', function ($query) { // ->whereHas('event', function ($query) {
$query->where('starttime', '>', now()) // $query->where('starttime', '>', now())
->where('betradar_id', 0); // ->where('betradar_id', 0);
}); // });
if ($get('country_id') ?? null) { // if ($get('country_id') ?? null) {
$res = $query->where('country_id', $get('country_id'))->get(); // $res = $query->where('country_id', $get('country_id'))->get();
} else { // } else {
$res = $query->get(); // $res = $query->get();
} // }
$arr = []; // $arr = [];
foreach ($res as $value) { // foreach ($res as $value) {
if (isset($map[$value->country_id])) { // if (isset($map[$value->country_id])) {
$arr[$value->id] = $map[$value->country_id].' '.$value->name; // $arr[$value->id] = $map[$value->country_id].' '.$value->name;
} else { // } else {
$arr[$value->id] = $value->name; // $arr[$value->id] = $value->name;
} // }
} // }
asort($arr); // asort($arr);
return $arr; // return $arr;
}) // })
->live(), // ->live(),
])->columnSpan(2), ])->columnSpan(2),
DateRangePicker::make('starttime_period') DateRangePicker::make('starttime_period')
->displayFormat('d M Y') ->displayFormat('d M Y')