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] Fixes #31124 #31125

Merged
merged 3 commits into from Jan 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Illuminate/Database/Eloquent/Model.php
Expand Up @@ -1150,7 +1150,14 @@ public function refresh()
static::newQueryWithoutScopes()->findOrFail($this->getKey())->attributes
);

$this->load(collect($this->relations)->except('pivot')->keys()->toArray());
$actualRelations = collect();
foreach ($this->relations as $key => $relation) {
if (! ($relation instanceof Pivot)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't work with AsPivot trait...

$actualRelations->put($key, $relation);
}
}

$this->load($actualRelations->keys()->toArray());

$this->syncOriginal();

Expand Down