F
Filament8mo ago
Sawal

how to not show return option when condition not fullfill

i want if not fulfill the condition it not enter the option, but in here it show the id, i want only not fulfill the condition appear in the option
No description
5 Replies
MohamedSabil83
MohamedSabil838mo ago
This method is for preparing the label of the option. You have to do the condition in either ->relation() or ->options() you have used.
Sawal
SawalOP8mo ago
can you tell me how to do it using ->options()?
MohamedSabil83
MohamedSabil838mo ago
Using options(): ->options(fn () => Student::where('nim', 'not like', 'D121%'))->pluck('nim', 'id') Using relation(): -relation('student', 'nim', fn ($query) => $query->where('nim', 'not like', 'D121%'))
Sawal
SawalOP8mo ago
ahh i see, it works, thank you for your help
MohamedSabil83
MohamedSabil838mo ago
You're welcome
Want results from more Discord servers?
Add your server