-
Notifications
You must be signed in to change notification settings - Fork 89
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
Feature request: Relationship join on pivot #49
Comments
@saibotk Seems like a valid feature request. I'll take a look at this when I have some time, probably next weekend. |
Here's an example of how you can modify the relationshipJoin function to only join the pivot table and not the related model's table:
This function works similarly to the relationshipJoin function, but instead of joining both the pivot table and the related model's table, it only joins the pivot table. You can use it like this:
|
Thanks @beshoo |
What do you think is the best way to achieve this? A extra method |
@brunolopesr I thought about the API for a while and couldn't come up with something that I liked, so not quite sure. It would be nice to do something like this: Post::joinRelationship('images', fn ($join) => $join->onlyPivot()); |
First of all: Thank you for the awesome package and happy easter 🐰 !
In our current project, we are using the relationshipJoins with various many-to-many relations, but do not really care about the data on the relationship table and instead only need to join the pivot table.
So I wanted to suggest adding a function, which does the same as relationshipJoin, which already does an inner join on the pivot, but does not also join the table of the related model.
Thanks
The text was updated successfully, but these errors were encountered: