From 2501654fec6f5c6bbf96cea370ceab26506ff7e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 26 Jul 2021 17:03:28 +0200 Subject: [PATCH] Add withData() to PaymentHash --- app/Models/PaymentHash.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Models/PaymentHash.php b/app/Models/PaymentHash.php index e82845415eab..0839120f5a9a 100644 --- a/app/Models/PaymentHash.php +++ b/app/Models/PaymentHash.php @@ -20,7 +20,6 @@ class PaymentHash extends Model protected $casts = [ 'data' => 'object', ]; - public function invoices() { @@ -41,4 +40,12 @@ class PaymentHash extends Model { return $this->belongsTo(Invoice::class, 'fee_invoice_id', 'id'); } + + public function withData(string $property, $value): PaymentHash + { + $this->data = array_merge((array) $this->data, [$property => $value]); + $this->save(); + + return $this; + } }