F
Filament9mo ago
tomc

I am trying to access a list of users who have a boolean "is_trainers" = true, kindly assist

Forms\Components\Select::make('course_trainer_id')
->relationship('trainers', 'name')
->preload()
->searchable()
->options(function (callable $get) {
return $get('users')
->where('is_trainer', true)
->pluck('id', 'name');
}),
Forms\Components\Select::make('course_trainer_id')
->relationship('trainers', 'name')
->preload()
->searchable()
->options(function (callable $get) {
return $get('users')
->where('is_trainer', true)
->pluck('id', 'name');
}),
Solution:
I think the third param for ->relationship() accepts a Closure to modify the query. You should use that one and drop ->options()
Jump to solution
1 Reply
Solution
Dennis Koch
Dennis Koch9mo ago
I think the third param for ->relationship() accepts a Closure to modify the query. You should use that one and drop ->options()
Want results from more Discord servers?
Add your server