© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
10 replies
bionary

How to filter table based on grandparent relationships?

Say I have relationship structure: Project > Category > Article > Illustration
I'm interested in filtering by Project when viewing the Illustration list.
I have set up all my
belongsTo()
belongsTo()
relationships. It's simple when using pure Laravel; to traverse back up the parents:
$illustration->article->category->project;

//works great!
$illustration->article->category->project;

//works great!

But in filament I'm not sure how to handle this type of filtering. I realize this would be easy if Laravel handled nested relationships but apparently it does not 😦

I also realized that you can do some filament stuff for Form: Selects in forms like this:
Group::make([
    Group::make([
        Group::make([
            Select::make('project_id')
                ->relationship('project','name')
                ->reactive()
                ->required()
        ])->relationship('category'),
    ])->relationship('article'),
]),
Group::make([
    Group::make([
        Group::make([
            Select::make('project_id')
                ->relationship('project','name')
                ->reactive()
                ->required()
        ])->relationship('category'),
    ])->relationship('article'),
]),

That admittedly works for forms, but I cannot seem to find a similar / suitable solution for filtering table data based on grandparent relationships.
(I also experimented with the
belongs-to-through
belongs-to-through
package, but that doesn't seem to work either)

Any help would be appreciated, thanks!
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 filter table results based on related table field?
FilamentFFilament / ❓┊help
2y ago
How to hide null relationships on table
FilamentFFilament / ❓┊help
2y ago
filter table data based on external API
FilamentFFilament / ❓┊help
3y ago
Eager loaded relationship based on table filter
FilamentFFilament / ❓┊help
3y ago