© 2026 Hedgehog Software, LLC

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

Accessing pivot model relationships in relationship manager

I have a relationship manager that handles a belongsToMany that is defined with
using(SomePivotModel::class)
using(SomePivotModel::class)
. The pivot model has a couple of belongsTo relationships defined. The belongsToMany relationship allows duplicates. If I don't have
allowDuplicates()
allowDuplicates()
set on the relationship manager table, then I can pull in data from the pivot model relationships in my columns (using a format like
pivot.somerelationship.name
pivot.somerelationship.name
). If I set the table to
allowDuplicates()
allowDuplicates()
, I can no longer access those pivot relationships. I can access the other columns in the pivot table, though they are no longer available as
pivot.somefield
pivot.somefield
, they are just at the top level. I see in the Filament code that this is because of a longstanding bug in Laravel about how it handles IDs in eloquent, though I'm not completely following the fix. I'm wondering if anyone else has run into this or has an idea of how I can access those pivot relationships when
allowDuplicates()
allowDuplicates()
is set.
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

relationship manager on belongs to many with pivot model throws error
FilamentFFilament / ❓┊help
3y ago
Self Referencing Model and Relationship Manager
FilamentFFilament / ❓┊help
3y ago
Create a relationship manager for a pivot table
FilamentFFilament / ❓┊help
3y ago
Relationship with pivot
FilamentFFilament / ❓┊help
3y ago