阅读(2603)
赞(1)
更新
2016-02-24 15:52:47 更新
更新数据表中的数据
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']);
← 添加