© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
ericmp #2

Sortable - Sort by far relationship

I have model A
Which has a relationship with a pivot, model B
The pivot has a relationship with another model, model C

In my filament table, which has model A as model for the query, I try to sort by an attribute of the model C
Tables\Columns\TextColumn::make('modelB.modelC.date')
    ->date('d/m/Y H:i')
    ->sortable(),
Tables\Columns\TextColumn::make('modelB.modelC.date')
    ->date('d/m/Y H:i')
    ->sortable(),

but i get:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'modelB_tablename.modelC.id' in 'where clause'
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'modelB_tablename.modelC.id' in 'where clause'
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

How to sort table by relationship?
FilamentFFilament / ❓┊help
15mo ago
sortable() in second-level relationship
FilamentFFilament / ❓┊help
2y ago
Sort resource by relationship count – exception when empty
FilamentFFilament / ❓┊help
3y ago
How to sort TextColumn by relationship date attribute?
FilamentFFilament / ❓┊help
3y ago