Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Feat: Accept Builder argument #3

Merged
merged 2 commits into from
Aug 27, 2020
Merged

Feat: Accept Builder argument #3

merged 2 commits into from
Aug 27, 2020

Conversation

mpyw
Copy link
Owner

@mpyw mpyw commented Aug 27, 2020

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()

@mpyw mpyw force-pushed the feat-accept-builder-argument branch from cd22261 to a726974 Compare August 27, 2020 14:04
@mpyw mpyw self-assigned this Aug 27, 2020
@mpyw mpyw merged commit 5ef4679 into master Aug 27, 2020
@mpyw mpyw deleted the feat-accept-builder-argument branch August 27, 2020 14:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant