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

Brake change in version 5.6.35 withoutGlobalScopes #25402

Closed
jn-jairo opened this issue Sep 1, 2018 · 0 comments
Closed

Brake change in version 5.6.35 withoutGlobalScopes #25402

jn-jairo opened this issue Sep 1, 2018 · 0 comments

Comments

@jn-jairo
Copy link
Contributor

jn-jairo commented Sep 1, 2018

  • Laravel Version: 5.6.35
  • PHP Version: 7.2.9
  • Database Driver & Version: mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64)

Description:

The version 5.6.35 broke my code because of this commit c59de77

The function withoutGlobalScopes in the relationship is not working as before.

In the version 5.6.34 it worked.

Steps To Reproduce:

class Post extends Model
{
    use SoftDeletes;

    public function comments()
    {
        return $this->morphMany(Comment::class, 'commentable');
    }
}

class Comment extends Model
{
    public function commentable()
    {
        return $this->morphTo()->withoutGlobalScopes();
    }
}

$post = factory(Post::class)->create();
$comment = factory(Comment::class)->make();
$post->comments()->save($comment);
$post->delete();

$post = Post::withTrashed()->find($post->id);

// In version 5.6.34 it works, now in version 5.6.35 it just returns null
$post->comments()->first()->commentable;
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

1 participant