From 4fa819a39bdffd6a40f205387f3dd98393b23f1d Mon Sep 17 00:00:00 2001 From: Jacob Bennett Date: Thu, 7 Jun 2018 15:07:44 -0500 Subject: [PATCH] Update ReturnsChildModels.php --- src/ReturnsChildModels.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ReturnsChildModels.php b/src/ReturnsChildModels.php index 0fa10d0..389a027 100644 --- a/src/ReturnsChildModels.php +++ b/src/ReturnsChildModels.php @@ -25,7 +25,13 @@ public function newInstance($attributes = [], $exists = false) public function newFromBuilder($attributes = [], $connection = null) { - return $this->newInstance((array) $attributes, true); + $model = $this->newInstance((array) $attributes, true); + + $model->setConnection($connection ?: $this->getConnectionName()); + + $model->fireModelEvent('retrieved', false); + + return $model; } public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null)