class Illuminate / Http / Resources / Json / ResourceResponse

ResourceResponse

Implements

Properties

public

$resource mixed

The underlying resource.

Default: null

Methods

public

__construct ( $resource ) : void

Create a new resource response.

Parameters

  • $resource mixed
public

toResponse ( $request ) : JsonResponse

Create an HTTP response that represents the object.

Parameters

protected

wrap ( $data , $with , $additional ) : array

Wrap the given data if necessary.

Parameters

  • $data array
  • $with array
  • $additional array
protected

haveDefaultWrapperAndDataIsUnwrapped ( $data ) : bool

Determine if we have a default wrapper and the given data is unwrapped.

Parameters

  • $data array
protected

haveAdditionalInformationAndDataIsUnwrapped ( $data , $with , $additional ) : bool

Determine if "with" data has been added and our data is unwrapped.

Parameters

  • $data array
  • $with array
  • $additional array
protected

wrapper ( ) : string

Get the default data wrapper for the resource.

protected

calculateStatus ( ) : int

Calculate the appropriate status code for the response.