PaginatedResourceResponse

class PaginatedResourceResponse extends ResourceResponse (View source)

Properties

mixed $resource The underlying resource. from ResourceResponse

Methods

void __construct(mixed $resource)

Create a new resource response.

from ResourceResponse
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.

from ResourceResponse
bool haveDefaultWrapperAndDataIsUnwrapped(array $data)

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

from ResourceResponse
bool haveAdditionalInformationAndDataIsUnwrapped(array $data, array $with, array $additional)

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

from ResourceResponse
string wrapper()

Get the default data wrapper for the resource.

from ResourceResponse
int calculateStatus()

Calculate the appropriate status code for the response.

from ResourceResponse
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 meta data for the response.

Details

void __construct(mixed $resource)

Create a new resource response.

Parameters

mixed $resource

Return Value

void

Response toResponse(Request $request)

Create an HTTP response that represents the object.

Parameters

Request $request

Return Value

Response

protected array wrap(array $data, array $with = [], array $additional = [])

Wrap the given data if necessary.

Parameters

array $data
array $with
array $additional

Return Value

array

protected bool haveDefaultWrapperAndDataIsUnwrapped(array $data)

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

Parameters

array $data

Return Value

bool

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

protected string wrapper()

Get the default data wrapper for the resource.

Return Value

string

protected int calculateStatus()

Calculate the appropriate status code for the response.

Return Value

int

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

protected array meta(array $paginated)

Gather the meta data for the response.

Parameters

array $paginated

Return Value

array

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Http/Resources/Json/PaginatedResourceResponse.html