trait HasAttributes (View source)
static bool | $snakeAttributes | Indicates whether attributes are snake cased on arrays. |
array | attributesToArray() Convert the model's attributes to an array. | |
array | relationsToArray() Get the model's relationships in array form. | |
mixed | getAttribute(string $key) Get an attribute from the model. | |
mixed | getAttributeValue(string $key) Get a plain attribute (not a relationship). | |
mixed | getRelationValue(string $key) Get a relationship. | |
bool | hasGetMutator(string $key) Determine if a get mutator exists for an attribute. | |
$this | setAttribute(string $key, mixed $value) Set a given attribute on the model. | |
bool | hasSetMutator(string $key) Determine if a set mutator exists for an attribute. | |
$this | fillJsonAttribute(string $key, mixed $value) Set a given JSON attribute on the model. | |
mixed | fromJson(string $value, bool $asObject = false) Decode the given JSON back into an array or object. | |
string | fromDateTime(DateTime|int $value) Convert a DateTime to a storable string. | |
array | getDates() Get the attributes that should be converted to dates. | |
$this | setDateFormat(string $format) Set the date format used by the model. | |
bool | hasCast(string $key, array|string|null $types = null) Determine whether an attribute should be cast to a native type. | |
array | getCasts() Get the casts array. | |
array | getAttributes() Get all of the current attributes on the model. | |
$this | setRawAttributes(array $attributes, bool $sync = false) Set the array of model attributes. No checking is done. | |
mixed|array | getOriginal(string|null $key = null, mixed $default = null) Get the model's original attribute values. | |
$this | syncOriginal() Sync the original attributes with the current. | |
$this | syncOriginalAttribute(string $attribute) Sync a single original attribute with its current value. | |
bool | isDirty(array|string|null $attributes = null) Determine if the model or given attribute(s) have been modified. | |
bool | isClean(array|string|null $attributes = null) Determine if the model or given attribute(s) have remained the same. | |
array | getDirty() Get the attributes that have been changed since last sync. | |
$this | append(array|string $attributes) Append attributes to query when building a query. | |
$this | setAppends(array $appends) Set the accessors to append to model arrays. | |
array | getMutatedAttributes() Get the mutated attributes for a given instance. | |
static void | cacheMutatedAttributes(string $class) Extract and cache all the mutated attributes of a class. |
Convert the model's attributes to an array.
Get the model's relationships in array form.
Get an attribute from the model.
Get a plain attribute (not a relationship).
Get a relationship.
Determine if a get mutator exists for an attribute.
Set a given attribute on the model.
Determine if a set mutator exists for an attribute.
Set a given JSON attribute on the model.
Decode the given JSON back into an array or object.
Convert a DateTime to a storable string.
Get the attributes that should be converted to dates.
Set the date format used by the model.
Determine whether an attribute should be cast to a native type.
Get the casts array.
Get all of the current attributes on the model.
Set the array of model attributes. No checking is done.
Get the model's original attribute values.
Sync the original attributes with the current.
Sync a single original attribute with its current value.
Determine if the model or given attribute(s) have been modified.
Determine if the model or given attribute(s) have remained the same.
Get the attributes that have been changed since last sync.
Append attributes to query when building a query.
Set the accessors to append to model arrays.
Get the mutated attributes for a given instance.
Extract and cache all the mutated attributes of a class.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Database/Eloquent/Concerns/HasAttributes.html