-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Global scope of pivotModel not included in whereHas() #429
Comments
@radmen Thanks for sharing a sample repo, it helps. Want to try it from Github as see if latest commit fixes the issue for you or not? |
@thetutlage thanks! It solves this issue. Btw, I have a question - is it possible to use scopes of A quick example (using soft-deletes package): User.query().whereHas('posts', qb => {
qp.withTrashed();
}); |
@thetutlage and @radmen Thanks it solved my issue. Though I need to test if I can use withTrashed() method in whereHas query. |
@thetutlage I know that you're a busy person, so apologies for bothering you. Could you check my previous comment it? Thank you. |
In the example you shared, you expect |
In this particular case, it's a scope method. I was expecting that it will be possible to call it as a "regular" query scope methods. // edit |
Any updates on this? @radmen @thetutlage |
This scenario requires following things:
belongsToMany
relationship usingpivotModel
The problem: queries using
whereHas
are not applying the global scope of a pivot model.Query generated by the builder:
should be:
Package version
6.1.3
Node.js and npm version
Sample Code (to reproduce the issue)
BONUS (a sample repo to reproduce the issue)
https://github.com/radmen/bug-adonis-where-has-pivot-scope
Setup:
Open: http://localhost:3333/
The text was updated successfully, but these errors were encountered: