update 方法返回影响数据的条数,没修改任何数据返回 0
- Db::table('user')
- ->where('id', 1)
- ->update(['name' => 'zhimatong']);
更新多个字段的写法:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/26195.html
- Db::table('user')
- ->where('id', 1)
- ->update([
- 'login_time' => ['exp','now()'],
- 'login_times' => ['exp','login_times+1'],
- ]);