F
Filament11mo ago
b14s_

Select input, when on the view page the id of the relation is shown instead of the name

I have a select input populated with the relationship helper
->relationship('company', 'name', fn (Builder $query) => $query->doesntHave('subscription'))
->relationship('company', 'name', fn (Builder $query) => $query->doesntHave('subscription'))
On the view page it shows the id of the selected record and not the name. Is there a way to fix this?
1 Reply
Patrick Boivin
Patrick Boivin11mo ago
Not sure what is causing the issue but maybe a workaround would be to hide the select field in the View context, and show a simple text input? Something like this:
Select::make('company')
// ...
->hiddenOn('view'),
TextInput::make('company.name')
->visibleOn('view'),
Select::make('company')
// ...
->hiddenOn('view'),
TextInput::make('company.name')
->visibleOn('view'),