摘要:
在laravel框架里面,有自增自减的函数: DB::table('users')->increment('votes'); DB::table('users')->increment('votes', 5); DB::table('users')->decrement('votes'); DB:: 阅读全文
摘要:
今天阅读laravel文档,整理了一些常用的查询构造器: 一、获取所有行 $users = DB::table('users')->get(); // 区别 Think 的 Select 二、获取单行/列 $user = DB::table('users')->where('name', 'John 阅读全文
摘要:
使用laravel框架,数据库的事务怎么做呢? 通常使用到事务,控制层或服务层通常需要使用【Db】来处理事务: 示例代码1: DB::transaction(function () { DB::table('users')->update(['votes' => 1]); DB::table('po 阅读全文