class PaginatedResourceResponse extends ResourceResponse

Properties

mixed $resource

The underlying resource.

from  ResourceResponse

Methods

__construct(mixed $resource)

Create a new resource response.

Response
toResponse(Request $request)

Create an HTTP response that represents the object.

array
wrap(Collection|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|null
wrapper()

Get the default data wrapper for the resource.

int
calculateStatus()

Calculate the appropriate status code for the response.

array
paginationInformation(Request $request)

Add the pagination information to the response.

array
paginationLinks(array $paginated)

Get the pagination links for the response.

array
meta(array $paginated)

Gather the metadata for the response.

Details

in ResourceResponse at line 23
__construct(mixed $resource)

Create a new resource response.

Parameters

mixed $resource

at line 16
Response toResponse(Request $request)

Create an HTTP response that represents the object.

Parameters

Request $request

Return Value

Response

in ResourceResponse at line 52
protected array wrap(Collection|array $data, array $with = [], array $additional = [])

Wrap the given data if necessary.

Parameters

Collection|array $data
array $with
array $additional

Return Value

array

in ResourceResponse at line 70
protected bool haveDefaultWrapperAndDataIsUnwrapped(array $data)

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

Parameters

array $data

Return Value

bool

in ResourceResponse at line 82
protected bool haveAdditionalInformationAndDataIsUnwrapped(array $data, array $with, array $additional)

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

Parameters

array $data
array $with
array $additional

Return Value

bool

in ResourceResponse at line 92
protected string|null wrapper()

Get the default data wrapper for the resource.

Return Value

string|null

in ResourceResponse at line 103
protected int calculateStatus()

Calculate the appropriate status code for the response.

Return Value

int

at line 49
protected array paginationInformation(Request $request)

Add the pagination information to the response.

Parameters

Request $request

Return Value

array

Get the pagination links for the response.

Parameters

array $paginated

Return Value

array

at line 82
protected array meta(array $paginated)

Gather the metadata for the response.

Parameters

array $paginated

Return Value

array