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

Fixed bug in postSave logic that was wiping out relations before push() #243

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Baum/Extensions/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public function reload() {

$this->setRawAttributes($fresh->getAttributes(), true);

$this->setRelations($fresh->getRelations());

$this->exists = $fresh->exists;
} else {
// Revert changes if model is not persisted
Expand Down Expand Up @@ -86,7 +84,9 @@ protected function getFreshInstance() {
if ( $this->areSoftDeletesEnabled() )
return static::withTrashed()->find($this->getKey());

return static::find($this->getKey());
$instance = static::find($this->getKey());
$instance->setRelations($this->getRelations());
return $instance;
}

/**
Expand Down