php - When laravel defines the same attribute of model and table, this field cannot be updated.
代言
代言 2017-06-13 09:21:48
0
2
851

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.

代言
代言

reply all(2)
Ty80

Either define the fields in the database as attribute names, or use it in the method instead:

$this->attributes['uid'] = $uid;
漂亮男人

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template