Skip to content

Commit 43dc9ae

Browse files
committed
fix inclusion
1 parent 0f31aa0 commit 43dc9ae

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Serializer.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,13 @@ protected function serializeIncluded($resource)
156156
if (!in_array($name, $included)) {
157157
continue;
158158
}
159-
if ($relationship instanceof ResourceInterface) {
160-
$data[] = $this->serializeModel($relationship);
159+
if (!is_array($relationship)) {
160+
$relationship = [$relationship];
161+
}
162+
foreach ($relationship as $model) {
163+
if ($model instanceof ResourceInterface) {
164+
$data[] = $this->serializeModel($model);
165+
}
161166
}
162167
}
163168
return $data;

0 commit comments

Comments
 (0)