Select in repeater

Hello everyone 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')),
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?
2 Replies
Umar Farooq
Umar Farooq9mo ago
GitHub
How to dynamically update select options · filamentphp filament · D...
I have a dropdown that I would like to update the options based on when another field is changed, how do I go about updating it. I would like to run a Closure is an ideal world.
DianaMujoiu
DianaMujoiuOP9mo ago
Thank you, I will try it I think is not working in repeater
Want results from more Discord servers?
Add your server