We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c115516 commit 5f48433Copy full SHA for 5f48433
src/Relations/EmbedsOneOrMany.php
@@ -275,17 +275,17 @@ protected function toCollection(array $records = [])
275
*/
276
protected function toModel($attributes = [])
277
{
278
- if ($attributes === null) {
279
- return;
280
- }
281
-
282
$connection = $this->related->getConnection();
283
284
$model = $this->related->newFromBuilder(
285
(array) $attributes,
286
$connection ? $connection->getName() : null,
287
);
288
+ if ($attributes === null) {
+ return $model;
+ }
+
289
$model->setParentRelation($this);
290
291
$model->setRelation($this->foreignKey, $this->parent);
0 commit comments