Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Commit 78f02bd

Browse files
committed
Allow relationship to be null
1 parent 78bc6e1 commit 78f02bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/AbstractSerializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public function getRelationship($model, $name)
5656
if (method_exists($this, $name)) {
5757
$relationship = $this->$name($model);
5858

59-
if (! ($relationship instanceof Relationship)) {
60-
throw new LogicException('Relationship method must return an instance of '
59+
if ($relationship !== null && ! ($relationship instanceof Relationship)) {
60+
throw new LogicException('Relationship method must return null or an instance of '
6161
.Relationship::class);
6262
}
6363

0 commit comments

Comments
 (0)