Convert has() and whereHas() constraints to non-dependent subqueries.
Drop support for stale versions (#6)
We now accept a
Builder
argument to prevent common mistakes.Comment::query()->hasByNonDependentSubquery( 'post', function (Relation $query) { // $query is a Relation instance $query->onlyTrashed(); } )->withTrashed()
Comment::query()->hasByNonDependentSubquery( 'post', function ($query) { // $query is a Relation instance $query->onlyTrashed(); } )->withTrashed()
Comment::query()->hasByNonDependentSubquery( 'post', function (Builder $query) { // $query is a Builder instance! (Previously it triggered an error) $query->onlyTrashed(); } )->withTrashed()
Release 🎉