diff --git a/src/Models/Relationships/RemoteRelationshipBuilder.php b/src/Models/Relationships/RemoteRelationshipBuilder.php index b8fed1c..f589f6f 100644 --- a/src/Models/Relationships/RemoteRelationshipBuilder.php +++ b/src/Models/Relationships/RemoteRelationshipBuilder.php @@ -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(); @@ -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]; } -} \ No newline at end of file +}