Skip to content

Commit 5f48433

Browse files
committed
let early return return the expected data
1 parent c115516 commit 5f48433

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/Relations/EmbedsOneOrMany.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,17 @@ protected function toCollection(array $records = [])
275275
*/
276276
protected function toModel($attributes = [])
277277
{
278-
if ($attributes === null) {
279-
return;
280-
}
281-
282278
$connection = $this->related->getConnection();
283279

284280
$model = $this->related->newFromBuilder(
285281
(array) $attributes,
286282
$connection ? $connection->getName() : null,
287283
);
288284

285+
if ($attributes === null) {
286+
return $model;
287+
}
288+
289289
$model->setParentRelation($this);
290290

291291
$model->setRelation($this->foreignKey, $this->parent);

0 commit comments

Comments
 (0)