Summary
Eloquent models allow users to transform attribute values when they are retrieved or set on model instances. Accessors can be used to encrypt values stored in the database and then automatically decrypt them when accessed on an Eloquent model
1
, or to convert JSON strings stored in the database to arrays.
1
Mutators can be used to format attribute values when retrieving or setting them on model instances.
2
Additionally, users can enable the default created_at and updated_at timestamps by setting the public $timestamps property of their model to false.
2
According to
See more results on Neeva
Summaries from the best pages on the web
Summary
Accessors, mutators, and attribute casting allow users to transform Eloquent attribute values when they are retrieved or set on model instances. Accessors can be used to encrypt values stored in the database and then automatically decrypt them when accessed on an Eloquent model. Accessors can also be used to convert JSON strings stored in the database to arrays when accessed via an Eloquent model.
Eloquent: Mutators & Casting - Laravel - The PHP Framework For Web Artisans
laravel.com
Summary
Eloquent allows users to format attribute values when retrieving or setting them on model instances. Accessors and mutators can be used to return new, computed values from existing attributes, and date fields can be automatically cast to Carbon instances or cast text fields to JSON. Additionally, users can enable the default created_at and updated_at timestamps by setting the public $timestamps property of their model to false.
Eloquent: Mutators - Laravel - The PHP Framework For Web Artisans
laravel.com