Skip to content

Commit 902408a

Browse files
haddowgGregory Haddow
andauthored
fix: custom relationship meta not returned on paginated responses (#23)
Co-authored-by: Gregory Haddow <gregory.haddow@chatloop.com>
1 parent f673e0e commit 902408a

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/Core/Responses/Concerns/HasRelationship.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private function allMeta(): ?Hash
4848
*
4949
* @return array|null
5050
*/
51-
private function metaForRelationship(): ?array
51+
protected function metaForRelationship(): ?array
5252
{
5353
if ($this->hasRelationMeta && $relation = $this->relation()) {
5454
return $relation->meta();

src/Core/Responses/Internal/PaginatedIdentifierResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function __construct(JsonApiResource $resource, string $fieldName, Page $
4343
public function meta(): Hash
4444
{
4545
return Hash::cast($this->page->meta())->merge(
46+
Hash::cast(parent::metaForRelationship())
47+
)->merge(
4648
parent::meta()
4749
);
4850
}

src/Core/Responses/Internal/PaginatedRelatedResourceResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function __construct(JsonApiResource $resource, string $fieldName, Page $
4343
public function meta(): Hash
4444
{
4545
return Hash::cast($this->page->meta())->merge(
46+
Hash::cast(parent::metaForRelationship())
47+
)->merge(
4648
parent::meta()
4749
);
4850
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy