In order to facilitate the operation of attributes in the model, the fields in the database are directly defined as attribute names.
These fields cannot be updated during update.
This uid field in the database cannot be added.
PHP中文网2017-06-13 09:23:48
Either define the fields in the database as attribute names, or use it in the method instead:
$this->attributes['uid'] = $uid;
漂亮男人2017-06-13 09:23:48
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 it
I’m kidding, __get cannot be triggered directly :p