-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data duplication on hasManyTrough with pivot #205
Comments
Hi @psust,
Are the queries failing with an error or are the duplicate (just) not getting removed? |
We also had some trouble with data duplication, encountering this error:
We solved it by adding |
Hey, sorry I forgot about this. I believe the duplication issue came from a problem with our database. Anyway I have this now and it seems to work: <?php
return $this->hasManyDeep(Property::class, [User::class, Person::class, "person_property"])
->distinct("properties.id"); |
I have a
persons
table and aproperties
table. They have a many to many relationship. So I have a tableperson_property
.Person::class
belongs toUser::class
which belongs toTenant::class
.How would you get all the properties of a Tenant ?
I tried:
But this returns me duplicate properties since I have a many to many relationship.
I tried appending to the relationship: ( like stated in #2 )
Neither of these worked.
I tried using a query instead of a relationship, but I faced the same problem of duplication.
The text was updated successfully, but these errors were encountered: