You can try to rewrite the__getmethod in this model. When obtaining variables, search them first from$this->attributes. However, this method is exactly the opposite of what laravel wants to do. It is a limited search. Attribute, if you can’t find it, go to$this->attributesand look for it
I’m kidding, __get cannot be triggered directly :p
Either define the fields in the database as attribute names, or use it in the method instead:
You can try to rewrite the
__get
method in this model. When obtaining variables, search them first from$this->attributes
. However, this method is exactly the opposite of what laravel wants to do. It is a limited search. Attribute, if you can’t find it, go to$this->attributes
and look for itI’m kidding, __get cannot be triggered directly :p