Methods |
public
|
__construct(mixed $resource): void
Create a new resource instance.
Create a new resource instance.
Overriden by
|
#
|
public
static
|
make(mixed ...$parameters): static
Create a new resource instance.
Create a new resource instance.
|
#
|
public
static
|
collection(mixed $resource): AnonymousResourceCollection
Create a new anonymous resource collection.
Create a new anonymous resource collection.
|
#
|
protected
static
|
newCollection(mixed $resource): AnonymousResourceCollection
Create a new resource collection instance.
Create a new resource collection instance.
|
#
|
public
|
resolve(Request|null $request = null): array
Resolve the resource to an array.
Resolve the resource to an array.
|
#
|
public
|
toArray(Request $request): array|Arrayable|JsonSerializable
Transform the resource into an array.
Transform the resource into an array.
Overriden by
|
#
|
public
|
toJson(int $options = 0): string
Convert the model instance to JSON.
Convert the model instance to JSON.
Throws
|
#
|
public
|
with(Request $request): array
Get any additional data that should be returned with the resource array.
Get any additional data that should be returned with the resource array.
|
#
|
public
|
additional(array $data): $this
Add additional meta data to the resource response.
Add additional meta data to the resource response.
|
#
|
public
|
jsonOptions(): int
Get the JSON serialization options that should be applied to the resource response.
Get the JSON serialization options that should be applied to the resource response.
|
#
|
public
|
withResponse(Request $request, JsonResponse $response): void
Customize the response for a request.
Customize the response for a request.
|
#
|
public
static
|
wrap(string $value): void
Set the string that should wrap the outer-most resource array.
Set the string that should wrap the outer-most resource array.
|
#
|
public
static
|
withoutWrapping(): void
Disable wrapping of the outer-most resource array.
Disable wrapping of the outer-most resource array.
|
#
|
public
|
response(Request|null $request = null): JsonResponse
Transform the resource into an HTTP response.
Transform the resource into an HTTP response.
|
#
|
public
|
toResponse(Request $request): JsonResponse
Create an HTTP response that represents the object.
Create an HTTP response that represents the object.
Overriden by
Implements
|
#
|
public
|
jsonSerialize(): array
Prepare the resource for JSON serialization.
Prepare the resource for JSON serialization.
Implements
|
#
|