© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
8 replies
billyma121182

Concating Fields in Select Option

I need to add the Project Name and IDs to select options. I have used a mutator in the model shown below.

protected function NameAndID(): Attribute
{
return Attribute::make(
get: fn() => $this->ProjectID . ' - ' . $this->ProjectName,
);
}

The NameAndID column works great in the form but not the filters where

SelectFilter::make('PaymentProjectID')->relationship('project', 'NameAndID')->label('Project'),

Gives me

Column not found: 1054 Unknown column 'project.NameAndID' in 'field list'

Any advise gratefully received!
Solution
SelectFilter::make('PaymentProjectID')
  ->relationship('project', 'ProjectName')
  ->getOptionLabelFromRecordUsing(fn($record) => $record->NameAndID)->label('Project'),
SelectFilter::make('PaymentProjectID')
  ->relationship('project', 'ProjectName')
  ->getOptionLabelFromRecordUsing(fn($record) => $record->NameAndID)->label('Project'),

Is the ticket
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

error in Dynamic fields based on a select option
FilamentFFilament / ❓┊help
2y ago
Dynamic fields based on a select option
FilamentFFilament / ❓┊help
3y ago
Dynamic Fields Based on Select Option Issue
FilamentFFilament / ❓┊help
3y ago
Pagination in select option
FilamentFFilament / ❓┊help
3y ago