Query included relationships #496
Answered
by
dominikb
chrisidakwo
asked this question in
Q&A
-
How can one easily query a relationship just like Laravel provides? Something like the image below: |
Beta Was this translation helpful? Give feedback.
Answered by
dominikb
Jul 28, 2020
Replies: 1 comment 1 reply
-
Have a look at this discussion: #499 As far as I know, this behavior can not be achieved directly using this package but rather the built-in methods on the underlying Something like this could work: QueryBuilder::for(Addon::class)
->allowedIncludes('subscriptions')
->whereHas('subscription', fn($builder) => $builder->where('addon_subscriptions.organization_id', $this->organizationId))
->get(); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
chrisidakwo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have a look at this discussion: #499
It treats a similar problem.
As far as I know, this behavior can not be achieved directly using this package but rather the built-in methods on the underlying
QueryBuilder
instance.Something like this could work: