laravel如何将字段更新到数据库 [英] laravel how to update a field to a database
本文介绍了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
这篇关于laravel如何将字段更新到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文