Skip to content

Query included relationships #496

Answered by dominikb
chrisidakwo asked this question in Q&A
Discussion options

You must be logged in to vote

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:

QueryBuilder::for(Addon::class)
    ->allowedIncludes('subscriptions')
    ->whereHas('subscription', fn($builder) => $builder->where('addon_subscriptions.organization_id', $this->organizationId))
    ->get();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chrisidakwo
Comment options

Answer selected by chrisidakwo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants