@@ -257,7 +257,7 @@ public function resolvePropertyInstances(array $props, Request $request): array
257
257
DeferProp::class,
258
258
AlwaysProp::class,
259
259
MergeProp::class,
260
- ])->first (fn ($ class ) => $ value instanceof $ class );
260
+ ])->first (fn ($ class ) => $ value instanceof $ class );
261
261
262
262
if ($ resolveViaApp ) {
263
263
$ value = App::call ($ value );
@@ -267,12 +267,12 @@ public function resolvePropertyInstances(array $props, Request $request): array
267
267
$ value = $ value ->wait ();
268
268
}
269
269
270
- if ($ value instanceof ResourceResponse || $ value instanceof JsonResource) {
271
- $ value = $ value ->toResponse ($ request )->getData (true );
272
- }
273
-
274
270
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
+ }
276
276
}
277
277
278
278
if (is_array ($ value )) {
@@ -309,22 +309,22 @@ public function resolveMergeProps(Request $request): array
309
309
{
310
310
$ resetProps = collect (explode (', ' , $ request ->header (Header::RESET , '' )));
311
311
$ 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 ));
315
315
316
316
$ deepMergeProps = $ mergeProps
317
- ->filter (fn ($ prop ) => $ prop ->shouldDeepMerge ())
317
+ ->filter (fn ($ prop ) => $ prop ->shouldDeepMerge ())
318
318
->keys ();
319
319
320
320
$ mergeProps = $ mergeProps
321
- ->filter (fn ($ prop ) => ! $ prop ->shouldDeepMerge ())
321
+ ->filter (fn ($ prop ) => ! $ prop ->shouldDeepMerge ())
322
322
->keys ();
323
323
324
324
return array_filter ([
325
325
'mergeProps ' => $ mergeProps ->toArray (),
326
326
'deepMergeProps ' => $ deepMergeProps ->toArray (),
327
- ], fn ($ prop ) => count ($ prop ) > 0 );
327
+ ], fn ($ prop ) => count ($ prop ) > 0 );
328
328
}
329
329
330
330
public function resolveDeferredProps (Request $ request ): array
0 commit comments