Skip to content

Commit

Permalink
fix: JsonApiResource::toArray don't filter on type and id
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark4ne committed Jun 9, 2022
1 parent 4aceb45 commit beacaf0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-1.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release note
============

# v1.1.9
### Fixes
- `JsonApiResource::toArray` don't filter on `type` and `id`

# v1.1.8
### Add
- `Skeleton::class` present skeleton of a `JsonApiResource::class`
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/JsonApiResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public function toArray(mixed $request, bool $included = true): array
];

if ($included) {
$data += [
$data += Arr::toArray(array_filter([
'attributes' => $this->requestedAttributes($request),
'relationships' => $this->requestedRelationships($request),
'links' => $this->toLinks($request),
'meta' => $this->toResourceMeta($request)
];
]));
}

return Arr::toArray(array_filter($data));
return $data;
}

/**
Expand Down

0 comments on commit beacaf0

Please sign in to comment.