From b87421f769800d4e160b6220752aea2fe68a1c70 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 28 Jul 2021 16:01:30 +1000 Subject: [PATCH] Fixes for locking --- app/Http/Controllers/PreviewController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index 7de8954b9e94..0eaf8e64c738 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -191,6 +191,8 @@ class PreviewController extends BaseController DB::connection(config('database.default'))->beginTransaction(); + try { + if($request->has('entity_id')){ $entity_obj = $class::withTrashed()->whereId($this->decodePrimaryKey($request->input('entity_id')))->company()->first(); @@ -252,6 +254,12 @@ class PreviewController extends BaseController if (request()->query('html') == 'true') { return $maker->getCompiledHTML; } + } + catch(\Exception $e){ + + DB::connection(config('database.default'))->rollBack(); + + } DB::connection(config('database.default'))->rollBack();