Select in repeater
Hello everyone
I have this select component in a repeater
When I add a new item to a repeater, I need the options in the select to exclude those already selected in other items. How can I do this?
I have this select component in a repeater
Select::make('work_point_id')
->reactive()
->afterStateUpdated(function ($state, Set $set){
$workPoint = WorkPoint::find((int) $state);
if ($workPoint) {
$set('alias',$workPoint->alias);
$set('name',$workPoint->name);
$set('county',$workPoint->county);
$set('city',$workPoint->city);
$set('street',$workPoint->street);
$set('number',$workPoint->number);
}
})
->options(function (Get $get, $state) {
return WorkPoint::where('company_id', $get('../../company_id'))
->pluck('name', 'id');
})
->label(__('app.resources.work_points.selected_work_point')), Select::make('work_point_id')
->reactive()
->afterStateUpdated(function ($state, Set $set){
$workPoint = WorkPoint::find((int) $state);
if ($workPoint) {
$set('alias',$workPoint->alias);
$set('name',$workPoint->name);
$set('county',$workPoint->county);
$set('city',$workPoint->city);
$set('street',$workPoint->street);
$set('number',$workPoint->number);
}
})
->options(function (Get $get, $state) {
return WorkPoint::where('company_id', $get('../../company_id'))
->pluck('name', 'id');
})
->label(__('app.resources.work_points.selected_work_point')),