Skip to content

Commit e078b45

Browse files
committed
resolve closure first
1 parent 0259e37 commit e078b45

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Response.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ public function resolvePartialProperties(array $props, Request $request): array
178178
public function resolveArrayableProperties(array $props, Request $request, bool $unpackDotProps = true): array
179179
{
180180
foreach ($props as $key => $value) {
181+
if ($value instanceof Closure) {
182+
$value = App::call($value);
183+
}
184+
181185
if ($value instanceof Arrayable) {
182186
$value = $value->toArray();
183187
}
@@ -186,10 +190,6 @@ public function resolveArrayableProperties(array $props, Request $request, bool
186190
$value = $this->resolveArrayableProperties($value, $request, false);
187191
}
188192

189-
if ($value instanceof Closure) {
190-
$value = App::call($value);
191-
}
192-
193193
if ($unpackDotProps && str_contains($key, '.')) {
194194
Arr::set($props, $key, $value);
195195
unset($props[$key]);

0 commit comments

Comments
 (0)