© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
Fly_Moe

searchable attribute

I created an attribute that combines the first name and last name of the customers relationship. This makes the column unsearchable.

protected function getFullNameAttribute(): array
 {
     return $this->customers->map(function ($customer) {
         return $customer->FirstName . ' ' . $customer->LastName;
     })->unique()->all();
 }
protected function getFullNameAttribute(): array
 {
     return $this->customers->map(function ($customer) {
         return $customer->FirstName . ' ' . $customer->LastName;
     })->unique()->all();
 }


I tried making is searchable based off the filament documentation like this but this doesn't work either. I'm probably doing something stupid. Any chance someone has done something similar and got this working?

 TextColumn::make('full_name')
       ->label('Users')
       ->badge()
       ->searchable(query: function (Builder $query, string $search): Builder {
            return $query
                 ->where('customer.FirstName', 'like', "%{$search}%")
                 ->orWhere('customer.LastName', 'like', "%{$search}%");
       })
 TextColumn::make('full_name')
       ->label('Users')
       ->badge()
       ->searchable(query: function (Builder $query, string $search): Builder {
            return $query
                 ->where('customer.FirstName', 'like', "%{$search}%")
                 ->orWhere('customer.LastName', 'like', "%{$search}%");
       })
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

Custom attribute searchable
FilamentFFilament / ❓┊help
2y ago
Making hidden attribute searchable
FilamentFFilament / ❓┊help
16mo ago
Searchable select using model's attribute as label
FilamentFFilament / ❓┊help
3y ago
->searchable()
FilamentFFilament / ❓┊help
13mo ago