From 8bc58a7e2ce5df682ce2ee1b9e20d4f8fb29df72 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 19 Dec 2021 08:54:38 +1100 Subject: [PATCH] Force DB Connection for transactions --- app/Services/Client/Statement.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Services/Client/Statement.php b/app/Services/Client/Statement.php index 7c2525204721..9a27def41654 100644 --- a/app/Services/Client/Statement.php +++ b/app/Services/Client/Statement.php @@ -110,7 +110,7 @@ class Statement } if ($this->rollback) { - DB::rollBack(); + \DB::connection(config('database.default'))->rollBack(); } @@ -129,7 +129,8 @@ class Statement } if (\is_null($this->entity)) { - DB::beginTransaction(); + \DB::connection(config('database.default'))->beginTransaction(); + $this->rollback = true; $invoice = InvoiceFactory::create($this->client->company->id, $this->client->user->id);