Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withoutGlobalScopes on morphTo relation is ignored on eager loading. #21856

Closed
kenan-recebli opened this issue Oct 28, 2017 · 1 comment
Closed

Comments

@kenan-recebli
Copy link

  • Laravel Version: 5.5.19
  • PHP Version: 7.0.24
  • Database Driver & Version: 5.7.18

Description:

I have a morphTo relation with withoutGlobalScopes and eager loading:

    /**
     * The relations to eager load on every query.
     *
     * @var array
     */
    protected $with = ['user', 'auditable'];

    /**
     * Get all of the auditable models.
     *
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
     */
    public function auditable()
    {
        return $this->morphTo()->withoutGlobalScopes();
    }

But withoutGlobalScopes isn't applied unless I use lazy loading.

#18052

@GrahamCampbell
Copy link
Member

Closing due to inactivity.

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

No branches or pull requests

2 participants