Skip to content

Commit beacaf0

Browse files
committed
fix: JsonApiResource::toArray don't filter on type and id
1 parent 4aceb45 commit beacaf0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG-1.1.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Release note
22
============
33

4+
# v1.1.9
5+
### Fixes
6+
- `JsonApiResource::toArray` don't filter on `type` and `id`
7+
48
# v1.1.8
59
### Add
610
- `Skeleton::class` present skeleton of a `JsonApiResource::class`

src/Resources/JsonApiResource.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ public function toArray(mixed $request, bool $included = true): array
3838
];
3939

4040
if ($included) {
41-
$data += [
41+
$data += Arr::toArray(array_filter([
4242
'attributes' => $this->requestedAttributes($request),
4343
'relationships' => $this->requestedRelationships($request),
4444
'links' => $this->toLinks($request),
4545
'meta' => $this->toResourceMeta($request)
46-
];
46+
]));
4747
}
4848

49-
return Arr::toArray(array_filter($data));
49+
return $data;
5050
}
5151

5252
/**

0 commit comments

Comments
 (0)