ApiResource
class ApiResource implements Stringable, ArrayAccess, JsonSerializable, Arrayable, Jsonable mixin ApiResponse
Traits
Methods
Forward a method call to the given object.
Forward a method call to the given object, returning $this if the forwarded call returned itself.
Throw a bad method call exception for the given method.
Get the resource body as a string.
Determine if an attribute exists on the resource.
Reject property assignment on the resource.
Reject unsetting a property on the resource.
Dynamically get properties from the underlying resource.
Dynamically pass method calls to the underlying resource.
Get the API response.
Get the API request.
Resolve the resource to an array.
Transform the resource into an array.
Convert the resource to its JSON representation.
Convert the resource to its pretty-printed JSON representation.
Prepare the resource for JSON serialization.
Determine if the given offset exists.
Get the value for a given offset.
Set the value at the given offset.
Unset the value at the given offset.
Details
in
ForwardsCalls at line 22
protected mixed
forwardCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object.
in
ForwardsCalls at line 52
protected mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object, returning $this if the forwarded call returned itself.
in
ForwardsCalls at line 66
static protected never
throwBadMethodCallException(string $method)
Throw a bad method call exception for the given method.
at line 28
__construct(ApiResponse $response, ApiRequest $request)
Create a new resource instance.
at line 37
string
__toString()
Get the resource body as a string.
at line 47
bool
__isset(string $key)
Determine if an attribute exists on the resource.
at line 57
void
__set(string $key, mixed $value)
Reject property assignment on the resource.
at line 65
void
__unset(string $key)
Reject unsetting a property on the resource.
at line 76
mixed
__get(string $key)
Dynamically get properties from the underlying resource.
at line 84
mixed
__call(string $method, array $parameters)
Dynamically pass method calls to the underlying resource.
at line 92
ApiResponse
getResponse()
Get the API response.
at line 100
ApiRequest
getRequest()
Get the API request.
at line 108
static ApiResource
make(ApiResponse $response, ApiRequest $request)
Create a new resource instance.
at line 120
array
resolve()
Resolve the resource to an array.
at line 132
array
toArray()
Transform the resource into an array.
at line 143
string
toJson(int $options = 0)
Convert the resource to its JSON representation.
at line 154
string
toPrettyJson(int $options = 0)
Convert the resource to its pretty-printed JSON representation.
at line 166
array
jsonSerialize()
Prepare the resource for JSON serialization.
at line 176
bool
offsetExists(mixed $offset)
Determine if the given offset exists.
at line 187
mixed
offsetGet(mixed $offset)
Get the value for a given offset.
at line 195
void
offsetSet(mixed $offset, mixed $value)
Set the value at the given offset.
at line 203
void
offsetUnset(mixed $offset)
Unset the value at the given offset.