© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
30 replies
Travis

How to use table builder to manage many-to-many relationship

Does anyone have any experience using the table builder package to create a table to manage a many-to-many relationship?

I have a simple many-to-many relationship with one of my models,
Profile
Profile
, and another one,
Attributes
Attributes
. I set up the table component to list the profile's attributes.

I set up
getTableQuery()
getTableQuery()
to return `Profile::attributes()->getQuery().

This works great....

Then, I add the AttachAction to the table's header actions, and this is where things begin to fall apart:
    protected function getTableHeaderActions(): array
    {
        return [
            Tables\Actions\AttachAction::make()
                ->relationship($this->profile->attributes())
                ->inverseRelationshipName('profile')
                ->recordTitleAttribute('name'),
        ];
    }
    protected function getTableHeaderActions(): array
    {
        return [
            Tables\Actions\AttachAction::make()
                ->relationship($this->profile->attributes())
                ->inverseRelationshipName('profile')
                ->recordTitleAttribute('name'),
        ];
    }


Trying to attach an attribute starts out fine: button, modal, dropdown...and when you type something, the generated query works and correctly returns the right data, but then it displays the same (wrong) value for each attribute: 'attribute'.

Does anyone have any experience/examples...? Any suggestions/guidance...? 🤔
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

Many-to-Many relationship Filament Table Builder V2
FilamentFFilament / ❓┊help
2y ago
Pivot column in many to many relationship - form builder
FilamentFFilament / ❓┊help
3y ago
How to Eager Load Nested Relationship in table builder
FilamentFFilament / ❓┊help
2y ago
🧩 How to Use reorderable() with Pivot Table Columns in Many-to-Many Relationships?
FilamentFFilament / ❓┊help
9mo ago