Add withData() to PaymentHash

This commit is contained in:
Benjamin Beganović 2021-07-26 17:03:28 +02:00
parent 7dd7a6e4b1
commit 2501654fec

View File

@ -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;
}
}