Skip to content

Commit

Permalink
Fix - Relationship Mocking (#10)
Browse files Browse the repository at this point in the history
* Make changes

* Fix issues
  • Loading branch information
atoff authored Feb 16, 2020
1 parent 0204cff commit 28760d6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Models/Relationships/RemoteRelationshipBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public function getModels($columns = ['*'])
$pivotAttributes = collect($results->firstWhere($details->relatedPivotKey, $model->getKey()))->mapWithKeys(function ($value, $key) {
return ['pivot_' . $key => $value];
});
return $model->setRawAttributes($pivotAttributes->all());

return $model->setRawAttributes(array_merge($pivotAttributes->all(), $model->getAttributes()));
});

return $models->all();
Expand Down Expand Up @@ -245,4 +246,4 @@ private function determineParentModelKey(): ?string
{
return isset($this->query->wheres[0]['value']) ? $this->query->wheres[0]['value'] : $this->query->wheres[0]['values'][0];
}
}
}

0 comments on commit 28760d6

Please sign in to comment.