这么写事务可以吗,是否需要自定义异常?
DB::beginTransaction();try{ // 删除角色信息 $adminRoleObj = new AdminRole; $result = $adminRoleObj->deleteAdminRole($admin->id); // 删除管理员信息 $result = $admin->delete(); DB::commit(); }catch(\Exception $e){ $result = false; Log::error('admin:delete '.$e->getMessage()); DB::rollBack(); }
郎朗坤