Last active
September 15, 2021 10:34
-
-
Save sidigi/f3b9ec805dcf4926ddea18b74e81c7b2 to your computer and use it in GitHub Desktop.
Test Api Resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
TestResponse::macro('fromResource', function(JsonResource $resource, ?Request $request = null){ | |
$request = $request ?? request(); | |
return new static($resource->toResponse($request)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment