Replies: 1 comment
-
Just to let you know, I found the solution thanks to Lary https://laracasts.com/discuss/channels/eloquent/afterquery-inside-global-scope?page=1&replyId=970833 |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have created a global scope to retrieve models only for the current tenant, something like this
Now I'd like to add an
afterQuery
to set the inverse of the relationship and avoid having to eager load the tenant for all modelsbut I've noticed this doesn't get applied consistently, I think because inside the
applyScope
function there's a$builder = clone $this
. Is there a workaround for this? May this be a bug? I've tried removing the clone but I'm getting some other errors.Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions