From b24350aba667beb91df63210bd4f76a6ea9ce010 Mon Sep 17 00:00:00 2001 From: harshjagad20 Date: Mon, 13 Dec 2021 10:40:28 +0530 Subject: [PATCH 1/2] fix payment update issue --- app/Models/Payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Payment.php b/app/Models/Payment.php index c4929462..d88030d9 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -183,7 +183,7 @@ class Payment extends Model implements HasMedia public function updatePayment($request) { - $data = $request->all(); + $data = $request->getPaymentPayload(); if ($request->invoice_id && (! $this->invoice_id || $this->invoice_id !== $request->invoice_id)) { $invoice = Invoice::find($request->invoice_id); From 6ce74bd59f8412b1c3fa176e6c3e2ba8d403c574 Mon Sep 17 00:00:00 2001 From: harshjagad20 Date: Mon, 13 Dec 2021 11:34:47 +0530 Subject: [PATCH 2/2] added migration to calculate base amount for payments table --- ...alculate_base_amount_of_payments_table.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 database/migrations/2021_12_13_055813_calculate_base_amount_of_payments_table.php diff --git a/database/migrations/2021_12_13_055813_calculate_base_amount_of_payments_table.php b/database/migrations/2021_12_13_055813_calculate_base_amount_of_payments_table.php new file mode 100644 index 00000000..24cb8da8 --- /dev/null +++ b/database/migrations/2021_12_13_055813_calculate_base_amount_of_payments_table.php @@ -0,0 +1,34 @@ +base_amount = $payment->exchange_rate * $payment->amount; + $payment->save(); + } + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}