1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Set Transactions on the correct database

This commit is contained in:
David Bomba 2021-06-24 21:52:02 +10:00
parent 79e56a4355
commit 0c9de66a80
3 changed files with 9 additions and 8 deletions

View File

@ -155,7 +155,7 @@ class PreviewController extends BaseController
$t = app('translator');
$t->replace(Ninja::transformTranslations(auth()->user()->company()->settings));
DB::beginTransaction();
DB::connection(config('database.default'))->beginTransaction();
$client = Client::factory()->create([
'user_id' => auth()->user()->id,
@ -230,7 +230,7 @@ class PreviewController extends BaseController
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
DB::rollBack();
DB::connection(config('database.default'))->rollBack();
$response = Response::make($file_path, 200);
$response->header('Content-Type', 'application/pdf');

View File

@ -45,8 +45,8 @@ class SubscriptionRepository extends BaseRepository
private function calculatePrice($subscription) :array
{
DB::beginTransaction();
// DB::beginTransaction();
DB::connection(config('database.default'))->beginTransaction();
$data = [];
$client = Client::factory()->create([
@ -90,8 +90,9 @@ class SubscriptionRepository extends BaseRepository
$data['promo_price'] = $invoice->calc()->getTotal();
DB::rollBack();
// DB::rollBack();
DB::connection(config('database.default'))->rollBack();
return $data;
}

View File

@ -239,7 +239,7 @@ class TemplateEngine
private function mockEntity()
{
DB::beginTransaction();
DB::connection(config('database.default'))->beginTransaction();
$client = Client::factory()->create([
'user_id' => auth()->user()->id,
@ -277,6 +277,6 @@ class TemplateEngine
private function tearDown()
{
DB::rollBack();
DB::connection(config('database.default'))->rollBack();
}
}