ResourceResponse
class ResourceResponse implements Responsable
Properties
| mixed | $resource | The underlying resource. |
Methods
Create a new resource response.
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.
Details
at line 23
__construct(mixed $resource)
Create a new resource response.
at line 31
Response
toResponse(Request $request)
Create an HTTP response that represents the object.
at line 52
protected array
wrap(Collection|array $data, array $with = [], array $additional = [])
Wrap the given data if necessary.
at line 70
protected bool
haveDefaultWrapperAndDataIsUnwrapped(array $data)
Determine if we have a default wrapper and the given data is unwrapped.
at line 82
protected bool
haveAdditionalInformationAndDataIsUnwrapped(array $data, array $with, array $additional)
Determine if "with" data has been added and our data is unwrapped.
at line 92
protected string|null
wrapper()
Get the default data wrapper for the resource.
at line 103
protected int
calculateStatus()
Calculate the appropriate status code for the response.