Hide disabledOption in Select
When disabling an option in Select I would like to not display that option.
How is this possible?
Solution:Jump to solution
eg this works for me - it hides the current user from the list of users
```php
Forms\Components\Select::make('user_id')
->relationship('user', 'name')
->options(fn() => User::whereNot('id' , auth()->id())->pluck('name', 'id')),...
7 Replies
Why not just not show it using
->options()
?
eg ->options(fn($record) => YourModel::whereNot('id', $record->id)->get('name', 'id')
or something similar?
(code just an example)Yeah that should work, lemme check if that does not interfere with the relationship
I've checked and the
->relationship()
parts overwrites the ->options()
partcan you try putting the
->options
after ->relationship
?I tried that, the order does not have a different effect
Solution
eg this works for me - it hides the current user from the list of users
Oh man my bad, I was currently working on a problem with SelectFilter and did not register that this problem was about Select
I will try this once more but than on the correct eleement
---
Yes that works!
Thank you for looking in to this