One to Many Relationship. Implementing --associate
'''
Hi,
I have,
Tables:
businesses
briefcases
So, a briefcase can have many business.
Business Model:
Briefcase Model:
Relation Manager --associate:
When trying to associate a business I get:
Any suggestions?
Thank you.
9 Replies
I think you need to define
$inverseRelationship = 'business';
in this caseHi Dennis,
Thank you for time and advice.
Your suggestion doesn't appear to solve my issue...
Following Laravel naming conventions I named the inverse of the relationship:
I have renamed it to:
I have also regenerated...
No luck...
I am sorry. I meant
briefcase
and it belongs on the relation manager classHi, I think I don't get what you mean...
You suggest I have to generate my BrifcaseResource relation manager as follows:
Thanks.
No, no need to generate something new. Just edit the relation manager file and add the property
Hey,
Thank you!
For the record... on my BriefcaseResource, RelationManagers, BusinessesRelationManager I added:
In the docs I found that $inverseRelationship should be used when "relationships with unconventional naming conventions". I don't see this is my case...
If you have a minute, is briefcase/briefcases somehow not supported?
And that still doesn’t work?
Now It is works...!
I should say thank you, now it works.
Nice. The default for RM is a belongsToMany/hasMany in both directions. That's why you need to add the inverseRelationship. Filament doesn't know about it from your models