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
No description
0 Replies
No replies yetBe the first to reply to this messageJoin