Skip to content

Commit

Permalink
Update ReturnsChildModels.php
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBennett authored Jun 7, 2018
1 parent 73c9d2f commit 4fa819a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ReturnsChildModels.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4fa819a

Please sign in to comment.