FilamentF
Filament2y ago
Ashk

Select relationship and "virtual" title attribute

Hello, I have a Customer model with a first_name and last_name field. A virtual field full_name which represents the concat of these 2 fields.
In another resource, which has an belongsTo Customer relationship, I'd like a select based on full_name.

Forms\Components\Select::make('customer_id')
    ->searchable()
    ->relationship(
        name: 'customer',
        titleAttribute: 'email' # working well with email, but I would like to filter by full_name instead of email
    ),


TY
Was this page helpful?