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); 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() + { + // + } +}