© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Litterboks

Relationship Manager for BelongsTo and HasMany Relationship

What I am trying to do:
I have a Relationship between Users and Domains.
I want to create a Relationship Manager for Domains on the User Resource so I can attach/detach Domains to/from Users in the Edit User View.

The Listing of all Domains for the user works fine.
The attaching / detaching of domains does not work.

My issue/the error:

When I click the button for associating / attaching a domain i get an SQL error.
- I do not know if associate or attach is the correct way to do it.
- The SQL Error is as follows:
Call to undefined method App\Models\Domain::users()
Call to undefined method App\Models\Domain::users()

This makes sense since it is not a many to many relationship and the relation on the Domain is called user.

Then i tried setting the $inverseRelationship to 'user' instead of 'users'
    protected static ?string $inverseRelationship = 'user';
    protected static ?string $inverseRelationship = 'user';

This seems to generally work for setting the name of the relationship however it results in even more errors.

My Database Tables are related via a user_id in the domains table.

Is there any way to use a Relationship Manager for One to Many Relationships?
Attached is a picture of the relationship manager, i redacted the rows. The 'Verknüpfen' button is where it crashes. The listing works fine.
I hope this is enough information
image.png
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

Why can't I attach record to HasMany - BelongsTo relationship through relation manager?
FilamentFFilament / ❓┊help
2y ago
HasMany relationship
FilamentFFilament / ❓┊help
3y ago
Associate BelongsTo relationship
FilamentFFilament / ❓┊help
3y ago
Issues with Attach/Associate action between a belongsTo/hasMany relationship
FilamentFFilament / ❓┊help
3y ago