laravel如何将字段更新到数据库
问题描述:
这是我的代码
$admin = Admin::find(25);
$admin->picture = $destination;
$admin->save();
但是当我执行它时,picture
字段保留为NULL
,例如images/admin_20
but when I execute it, the picture
field is keep NULL
for example images/admin_20
destination
是图像位置的字符串.
the destination
is a string to the location of the image.
我已经尝试过->update()
,但是什么也没有保存.
I already tried ->update()
but also nothing becomes saved.
你能帮我吗
我数据库中的picture
列是varchar(255) utf8_unicode_ci
答
最后我找到了问题,三天的时间解决了这个愚蠢的错误
Finally I found the problem, three days working to this silly mistake
我数据库中的ID
列应该是id
the ID
column in my database should have been id