Skip to content

Commit

Permalink
let early return return the expected data
Browse files Browse the repository at this point in the history
  • Loading branch information
Treggats committed Nov 16, 2023
1 parent c115516 commit 31157c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Relations/EmbedsOneOrMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,21 @@ protected function toCollection(array $records = [])
/**
* Create a related model instanced.
*
* @param array $attributes
* @param mixed $attributes
*
* @return Model
* @return Model | null
*/
protected function toModel($attributes = [])
protected function toModel(mixed $attributes = []): Model|null
{
if ($attributes === null) {
return;
return null;
}

$connection = $this->related->getConnection();

$model = $this->related->newFromBuilder(
(array) $attributes,
$connection ? $connection->getName() : null,
$connection?->getName(),
);

$model->setParentRelation($this);
Expand Down

0 comments on commit 31157c0

Please sign in to comment.