Skip to content

Commit f0864ee

Browse files
committed
fix: allow the ability to manipulate related results
1 parent 16e8c61 commit f0864ee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Http/Resources/Contracts/AllowableFields.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ protected function onlyAllowed($request): array
5151
return in_array(Helpers::camel($key), $fields);
5252
}, ARRAY_FILTER_USE_KEY);
5353

54-
return $this->mapRelatedResources($resources);
54+
return $this->mapRelatedResources($resources, $request);
5555
}
5656

57-
protected function mapRelatedResources($resources)
57+
protected function mapRelatedResources($resources, $request)
5858
{
5959
if (empty(static::$mapResources)) {
6060
return $resources;
6161
}
6262

6363
foreach ($resources as $key => $value) {
6464
if (array_key_exists($key, static::$mapResources)) {
65-
$resources[$key] = static::$mapResources[$key]::make($this->{Helpers::camel($key)});
65+
$resources[$key] = static::$mapResources[$key]::make($this->{Helpers::camel($key)})->toArray();
6666
}
6767
}
6868

0 commit comments

Comments
 (0)