@@ -257,7 +257,7 @@ public function resolvePropertyInstances(array $props, Request $request): array
257257 DeferProp::class,
258258 AlwaysProp::class,
259259 MergeProp::class,
260- ])->first (fn ($ class ) => $ value instanceof $ class );
260+ ])->first (fn ($ class ) => $ value instanceof $ class );
261261
262262 if ($ resolveViaApp ) {
263263 $ value = App::call ($ value );
@@ -267,12 +267,12 @@ public function resolvePropertyInstances(array $props, Request $request): array
267267 $ value = $ value ->wait ();
268268 }
269269
270- if ($ value instanceof ResourceResponse || $ value instanceof JsonResource) {
271- $ value = $ value ->toResponse ($ request )->getData (true );
272- }
273-
274270 if ($ value instanceof Responsable) {
275- $ value = $ value ->toResponse ($ request )->getData (true );
271+ $ _response = $ value ->toResponse ($ request );
272+
273+ if (method_exists ($ _response , 'getData ' )) {
274+ $ value = $ _response ->getData (true );
275+ }
276276 }
277277
278278 if (is_array ($ value )) {
@@ -309,22 +309,22 @@ public function resolveMergeProps(Request $request): array
309309 {
310310 $ resetProps = collect (explode (', ' , $ request ->header (Header::RESET , '' )));
311311 $ mergeProps = collect ($ this ->props )
312- ->filter (fn ($ prop ) => $ prop instanceof Mergeable)
313- ->filter (fn ($ prop ) => $ prop ->shouldMerge ())
314- ->filter (fn ($ _ , $ key ) => ! $ resetProps ->contains ($ key ));
312+ ->filter (fn ($ prop ) => $ prop instanceof Mergeable)
313+ ->filter (fn ($ prop ) => $ prop ->shouldMerge ())
314+ ->filter (fn ($ _ , $ key ) => ! $ resetProps ->contains ($ key ));
315315
316316 $ deepMergeProps = $ mergeProps
317- ->filter (fn ($ prop ) => $ prop ->shouldDeepMerge ())
317+ ->filter (fn ($ prop ) => $ prop ->shouldDeepMerge ())
318318 ->keys ();
319319
320320 $ mergeProps = $ mergeProps
321- ->filter (fn ($ prop ) => ! $ prop ->shouldDeepMerge ())
321+ ->filter (fn ($ prop ) => ! $ prop ->shouldDeepMerge ())
322322 ->keys ();
323323
324324 return array_filter ([
325325 'mergeProps ' => $ mergeProps ->toArray (),
326326 'deepMergeProps ' => $ deepMergeProps ->toArray (),
327- ], fn ($ prop ) => count ($ prop ) > 0 );
327+ ], fn ($ prop ) => count ($ prop ) > 0 );
328328 }
329329
330330 public function resolveDeferredProps (Request $ request ): array
0 commit comments