Skip to content

Conversation

@tpetry
Copy link
Contributor

@tpetry tpetry commented Apr 11, 2022

As commented on #41918 I found a new inconsistency in the Laravel 8.x and 9.x implementation with the fix by @driesvints.

In Laravel v8 the implementation for getBaseQuery was:

public function getBaseQuery()
{
    return $this->query->getQuery();
}

With the recently merged fix it's now the following which is different (it's now applying the scope!):

public function getBaseQuery()
{
    return $this->toBase();
}

public function toBase()
{
    return $this->query->applyScopes()->getQuery();
}

I restored the exact behavior of Laravel 8.x that getBaseQuery and toBase are both operating directly on the Eloquent\Builder object. So any change in Eloquent\Builder::toBase() is also automatically reflected on Relationship::toBase() as in Laravel 8.x.

Copy link
Member

@driesvints driesvints left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably indeed is the better fix. Thanks @tpetry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants