From e671b98fdbb48aa8e3bb25bb6ac5f8aa467704a3 Mon Sep 17 00:00:00 2001 From: moayad Date: Mon, 18 Dec 2023 03:03:19 +0200 Subject: [PATCH] fix update payment module issue when catch an exception --- src/PaymentServiceProvider.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/PaymentServiceProvider.php b/src/PaymentServiceProvider.php index e4ae42a..fb15ac0 100644 --- a/src/PaymentServiceProvider.php +++ b/src/PaymentServiceProvider.php @@ -15,6 +15,7 @@ use Corals\Settings\Facades\Modules; use Corals\User\Communication\Facades\CoralsNotification; use Illuminate\Foundation\AliasLoader; +use Illuminate\Support\Facades\DB; class PaymentServiceProvider extends BasePackageServiceProvider { @@ -93,9 +94,11 @@ public function bootPackage() $this->addEvents(); } catch (\Exception $exception) { if (isset($payment_module)) { - $payment_module->enabled = 0; - $payment_module->notes = $exception->getMessage(); - $payment_module->save(); + \DB::table('modules')->where('code', $payment_module->code) + ->update([ + 'enabled' => 0, + 'notes' => $exception->getMessage() + ]); flash(trans( 'Payment::exception.payment_service.error_load_module', ['code' => $payment_module->code]