© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•5mo ago•
1 reply
kaster

Sortable and Searchable in pivot column not working

I have a many-to-many relationship between Company and Person.
The pivot table and model (CompanyPerson) has an office column that refers to another model.

The data displays correctly in the table when accessing "pivot.office.name", but the ->searchable() and ->sortable() methods don’t work.
What is the best way to fix this?

This is the error I get when trying to search for an office name:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pivot' in 'WHERE'
select
count(*) as aggregate
from
companies
companies

inner join
company_person
company_person
on
companies
companies
.
id
id
=
company_person
company_person
.
company_id
company_id

where
company_person
company_person
.
person_id
person_id
= 1
and (
json_unquote(json_extract(
pivot
pivot
, '$."office"."name"')) like % a %
)
and
companies
companies
.
deleted_at
deleted_at
is null

And this is the table:
public function table(Table $table): Table
    {
        return $table
            ->recordTitleAttribute('name')
            ->columns([
                TextColumn::make('name')
                    ->sortable(),
                TextColumn::make('pivot.office.name')
                    ->label('Office')
                    ->searchable()
                    ->sortable(),
            ])
public function table(Table $table): Table
    {
        return $table
            ->recordTitleAttribute('name')
            ->columns([
                TextColumn::make('name')
                    ->sortable(),
                TextColumn::make('pivot.office.name')
                    ->label('Office')
                    ->searchable()
                    ->sortable(),
            ])


Everything works, except making the pivot column searchable and sortable.
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

Searchable not working in column
FilamentFFilament / ❓┊help
3y ago
->sortable(), searchable(), and pagination not working with Livewire
FilamentFFilament / ❓┊help
2y ago
How to searchable and sortable my custom column?
FilamentFFilament / ❓┊help
3y ago
Searchable and sortable on polymorph
FilamentFFilament / ❓┊help
3y ago