ELOQUENT: MUTATORS & CASTING
Accessors, mutators, and attribute casting allow you to transform Eloquent attribute values when you retrieve or set them on model instances. For example, you may want to use the Laravel encrypter to encrypt a value while it is stored in the database, and then automatically decrypt the attribute when you access it on an Eloquent model. Or, you may want to convert a JSON string that is stored in your database to an array when it is accessed via your Eloquent model.
You can read more on : https://laravel.com/docs/10.x/eloquent-mutators
Category
WRITE A COMMENT