如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
<code class="">事务操作
DB::beginTransaction();
try {
DB::insert(...);
DB::insert(...);
DB::insert(...);
DB::commit();
// all good
} catch (\Exception $e) {
DB::rollback();
// something went wrong
}
打印sql
// DB::connection()->enableQueryLog();#开启执行日志
$r_parm = objectToArrayLaravel(Db::table('product_sku_info_parm')->select('info_id',DB::raw('count(id) as sumii'))
->where($where)
->where(function ($query) use ($orWhere) {
$query->orWhere($orWhere);
})
->orderBy("sumii","desc")
->groupBy('info_id')->first());
// print_r(DB::getQueryLog());
</code>