Replies: 1 comment
-
How's it going? In Laravel, the whereBelongsTo method is used to simplify queries on "belongs to" relationships, while there is no whereBelongsToMany method because "belongs to many" relationships usually involve more complexity due to the pivot table. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was aligning our codebase with the various relation query usages and came across a "discrepency" (consistency is king in our codebase
When refactoring
->where('user_id', $user->id)
towhereBelongsTo($user)
I came across a belongsToMany-relation and thought about the same reasoning:->whereBelongsToMany($users)
but was stumped that this simply isnt there...Is there reasoning behind this? I'd love to do this.
Beta Was this translation helpful? Give feedback.
All reactions