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

[5.5] don't reload pivot relationship on refresh #21713

Merged
merged 1 commit into from
Oct 17, 2017

Conversation

themsaid
Copy link
Member

Having a ManyToMany relationship between posts and tags;

$tag = $post->tags()->first();

If we do $tag->refresh() an exception is thrown because Eloquent will try to load a relationship with name pivot which doesn't exist, in the PR we just exclude that key from the list of relationships to reload.

We also load the model attributes before loading the relationships to catch any changes in relationship keys before trying to load the relationship again.

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.

2 participants