事务
public function transaction(Request $request)
{
DB::beginTransaction();
$sql = DB::table('t_admin')->where('id',144)->delete();
$sql2 = DB::table('t_icode')->where('id',123)->delete();
if ($sql&&$sql2){
//如果语句执行成功就进行提交
DB::commit();
return success;
}else{
//如果失败就回滚
DB::rollback();
return error;
}
}