© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
mohdaftab

BelongsToMany TextColumn first_name last_name searchable

Hello,

How do I make the TextColumn searchable by first_name and last_name for a belongsToMany relationship please?
I have a property listing attached to users table with relationship name as "agents" and I need to make the agent name searchable in TextColumn please.
Please see the attached pictures for the code.
Thank you
image.png
image.png
Solution
You could use a virtual column

$table->string('full_name')->virtualAs('concat(first_name, \' \', last_name)');
$table->string('full_name')->virtualAs('concat(first_name, \' \', last_name)');


Tables\Columns\TextColumn::make('agents.full_name')
    ->badge()
    ->searchable()
Tables\Columns\TextColumn::make('agents.full_name')
    ->badge()
    ->searchable()
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

TextColumn with relationship first_name, last_name
FilamentFFilament / ❓┊help
3y ago
TextColumn BelongsToMany
FilamentFFilament / ❓┊help
2y ago
Error in searchable TextColumn
FilamentFFilament / ❓┊help
13mo ago
TextColumn searchable function anomaly.
FilamentFFilament / ❓┊help
15mo ago