F
Filament4mo ago
Valcro

Select Column relationship in Table.

I'm currently populating the select using the options closure:
Tables\Columns\SelectColumn::make('currency_id')
->label('Currency')
->options(fn (Currency $currency) => $currency->pluck('name', 'id'))
Tables\Columns\SelectColumn::make('currency_id')
->label('Currency')
->options(fn (Currency $currency) => $currency->pluck('name', 'id'))
But do we have a way to access a relationship like as in the Form Builder?:
Forms\Components\Select::make('currency_id')
->relationship(name: 'currency', titleAttribute: 'name')
Forms\Components\Select::make('currency_id')
->relationship(name: 'currency', titleAttribute: 'name')
Is there a better way to do this?
Solution:
There doesn't seem to be an available relationship. You could continue using the 'options' method ```php SelectColumn::make('currency_id') ->options(Currency::pluck('name', 'id'))...
Jump to solution
1 Reply
Solution
LeandroFerreira
LeandroFerreira4mo ago
There doesn't seem to be an available relationship. You could continue using the 'options' method
SelectColumn::make('currency_id')
->options(Currency::pluck('name', 'id'))
SelectColumn::make('currency_id')
->options(Currency::pluck('name', 'id'))