Resource
class Resource implements ArrayAccess, JsonSerializable, Responsable, UrlRoutable (View source)
Traits
DelegatesToResource |
Properties
mixed | $resource | The resource instance. | |
array | $with | The additional data that should be added to the top-level resource array. | |
array | $additional | The additional meta data that should be added to the resource response. | |
static string | $wrap | The "data" wrapper that should be applied. | |
string | $collects |
Methods
mixed | getRouteKey() Get the value of the resource's route key. | from DelegatesToResource |
string | getRouteKeyName() Get the route key for the resource. | from DelegatesToResource |
void | resolveRouteBinding(mixed $value) Retrieve the model for a bound value. | from DelegatesToResource |
bool | offsetExists(mixed $offset) Determine if the given attribute exists. | from DelegatesToResource |
mixed | offsetGet(mixed $offset) Get the value for a given offset. | from DelegatesToResource |
void | offsetSet(mixed $offset, mixed $value) Set the value for a given offset. | from DelegatesToResource |
void | offsetUnset(mixed $offset) Unset the value for a given offset. | from DelegatesToResource |
bool | __isset(string $key) Determine if an attribute exists on the resource. | from DelegatesToResource |
void | __unset(string $key) Unset an attribute on the resource. | from DelegatesToResource |
mixed | __get(string $key) Dynamically get properties from the underlying resource. | from DelegatesToResource |
mixed | __call(string $method, array $parameters) Dynamically pass method calls to the underlying resource. | from DelegatesToResource |
void | __construct(mixed $resource, string $collects) Create a new anonymous resource collection. | |
static Resource | make(dynamic $parameters) Create a new resource instance. | |
static mixed | collection(mixed $resource) Create new anonymous resource collection. |
Details
mixed getRouteKey()
Get the value of the resource's route key.
string getRouteKeyName()
Get the route key for the resource.
void resolveRouteBinding(mixed $value)
Retrieve the model for a bound value.
bool offsetExists(mixed $offset)
Determine if the given attribute exists.
mixed offsetGet(mixed $offset)
Get the value for a given offset.
void offsetSet(mixed $offset, mixed $value)
Set the value for a given offset.
void offsetUnset(mixed $offset)
Unset the value for a given offset.
bool __isset(string $key)
Determine if an attribute exists on the resource.
void __unset(string $key)
Unset an attribute on the resource.
mixed __get(string $key)
Dynamically get properties from the underlying resource.
mixed __call(string $method, array $parameters)
Dynamically pass method calls to the underlying resource.
void __construct(mixed $resource, string $collects)
Create a new anonymous resource collection.
static Resource make(dynamic $parameters)
Create a new resource instance.
static mixed collection(mixed $resource)
Create new anonymous resource collection.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.5/Illuminate/Http/Resources/Json/Resource.html