Create model custom attributes in documentation? #54044
-
Hi all. Correct me if I am wrong, but nowhere in the documentation is it explained how to cast/create a custom attribute for your model, that is not part of the fillable properties. What I mean is, let's have a user model with 2 fields: name and last_name. Now, anywhere on your code, you can do like
and then just use may be it should be added somewhere in the documentation, as this is very usefull. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
They moved away from this type of mutators in Laravel 9. https://laravel.com/docs/11.x/eloquent-mutators#defining-a-mutator vs https://laravel.com/docs/8.x/eloquent-mutators#defining-a-mutator |
Beta Was this translation helpful? Give feedback.
They moved away from this type of mutators in Laravel 9. https://laravel.com/docs/11.x/eloquent-mutators#defining-a-mutator vs https://laravel.com/docs/8.x/eloquent-mutators#defining-a-mutator