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

[6.x] Override BelongsToMany::cursor() to hydrate pivot relations #30580

Merged
merged 1 commit into from Nov 13, 2019
Merged

[6.x] Override BelongsToMany::cursor() to hydrate pivot relations #30580

merged 1 commit into from Nov 13, 2019

Conversation

mpyw
Copy link
Contributor

@mpyw mpyw commented Nov 13, 2019

Overview

Currently pivot relations are not hydrated over cursor() request. We need to override it like each() chunk() chunkById() paginate() simplePaginate().

foreach (Post::first()->tags()->cursor() as $tag) {
    dump($tag->pivot->flag); // This cannot be correctly retrieved now
}

It seems that HasManyThrough::cursor() is already correctly implemented.

Related PRs

@taylorotwell taylorotwell merged commit 2f3a8f1 into laravel:6.x Nov 13, 2019
@mpyw mpyw deleted the fix/add-missing-belongstomany-cursor branch November 13, 2019 14:55
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.

None yet

2 participants