NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
# 更新 ## 更新数据表中的数据 ``` DB::table('users') ->where('id', 1) ->update(['votes' => 1]); ``` ## 自增或自减一个字段的值 ``` DB::table('users')->increment('votes'); DB::table('users')->increment('votes', 5); DB::table('users')->decrement('votes'); DB::table('users')->decrement('votes', 5); ``` 也能够同时指定其他要更新的字段: ``` DB::table('users')->increment('votes', 1, ['name' => 'John']); ```