F
Filament16mo ago
kingtox

How to access the Search variable inside recordSelectOptionsQuery of Relation Manager

i am working on advance relationship which is Many to Many Polymorphic, all the relation are working fine for attach and detach, however when i search for specific name in the AttachAction it shows an error, is there any way we can disable $recordTitleAttribute and search for the record in recordSelectOptionsQuery() this is what i tried so far!
AttachAction::make()
->label('Attach Employee')
->recordTitle(fn (Model $record) => $record->user->name)
->recordSelectSearchColumns(['name'])
->recordSelectOptionsQuery(fn(Builder $query, $livewire) => $query->whereHas('user'))
->form(fn (AttachAction $action): array => [
$action->getRecordSelect()
->label('Select Employee Profile')
->placeholder('Search Profile')
->disableLabel(false),
])
->preloadRecordSelect()
->modalHeading('Attach Employee')
AttachAction::make()
->label('Attach Employee')
->recordTitle(fn (Model $record) => $record->user->name)
->recordSelectSearchColumns(['name'])
->recordSelectOptionsQuery(fn(Builder $query, $livewire) => $query->whereHas('user'))
->form(fn (AttachAction $action): array => [
$action->getRecordSelect()
->label('Select Employee Profile')
->placeholder('Search Profile')
->disableLabel(false),
])
->preloadRecordSelect()
->modalHeading('Attach Employee')
i would like to search for a record in $query->whereHas('user')
1 Reply
kingtox
kingtoxOP16mo ago
Want results from more Discord servers?
Add your server