插入数据库
1 | Companyauth::insert($data); |
更新
1 | Companyauth::where('uid',$uid)->update($data); |
查询
1 | Companyauth::where('uid',$uid)->find(1); |
orderBy和limit组合
1 | Companyauth::orderBy('id','desc')->take(6)->get(); |
where条件
1 | Newsinformation::where('id','<',$id)->first(); |
left join
1 | $prdList = Product::where('product.type',2) |
从配置文件读取数据
1 | $choiseType = Config::get('user.choicetype'); |
单一纪录
1 | Newsinformation::where('id','<',$id)->first(); |
连表查询、排序
1 | $fields = [ |
单一查询
1 |
|
自减
1 | DB::table('product') |
更新
1 | DB::table('product') |
添加返回id
```php
DB::table(‘comment’)
->insertGetId($fields);