class Illuminate / Http / Resources / Json / ResourceCollection
You are viewing an older version of the documentation. For the latest, please visit master documentation.

ResourceCollection

Extends

Implements

Uses

Properties

public

$collects string

The resource that this resource collects.

Default: null
public

$collection Collection

The mapped collection instance.

Default: null
protected

$preserveAllQueryParameters bool

Indicates if all existing request query parameters should be added to pagination links.

Default: false
protected

$queryParameters array|null

The query parameters that should be added to the pagination links.

Default: null

Methods

public

__construct ( $resource ) : void

Create a new resource instance.

Parameters

  • $resource mixed
public

preserveQuery ( ) : $this

Indicate that all current query parameters should be appended to pagination links.

public

withQuery ( array $query ) : $this

Specify the query string parameters that should be present on pagination links.

Parameters

  • $query array
public

count ( ) : int

Return the count of items in the resource collection.

public

toArray ( $request ) : array|Arrayable |JsonSerializable

Transform the resource into a JSON array.

Parameters

public

toResponse ( $request ) : JsonResponse

Create an HTTP response that represents the object.

Parameters

protected

preparePaginatedResponse ( $request ) : JsonResponse

Create a paginate-aware HTTP response.

Parameters