class ResourceResponse implements Responsable (View source)
mixed | $resource | The underlying resource. |
void | __construct(mixed $resource) Create a new resource response. | |
Response | toResponse(Request $request) Create an HTTP response that represents the object. | |
array | wrap(array $data, array $with = [], array $additional = []) Wrap the given data if necessary. | |
bool | haveDefaultWrapperAndDataIsUnwrapped(array $data) Determine if we have a default wrapper and the given data is unwrapped. | |
bool | haveAdditionalInformationAndDataIsUnwrapped(array $data, array $with, array $additional) Determine if "with" data has been added and our data is unwrapped. | |
string | wrapper() Get the default data wrapper for the resource. | |
int | calculateStatus() Calculate the appropriate status code for the response. |
Create a new resource response.
Create an HTTP response that represents the object.
Wrap the given data if necessary.
Determine if we have a default wrapper and the given data is unwrapped.
Determine if "with" data has been added and our data is unwrapped.
Get the default data wrapper for the resource.
Calculate the appropriate status code for the response.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Http/Resources/Json/ResourceResponse.html