From c91b71c253c86337577a4597dea7ee6098dd2269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Thu, 22 Feb 2024 09:24:18 +0100 Subject: [PATCH] add payment status --- src/Models/Order.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Models/Order.php b/src/Models/Order.php index 24f5fb78..173fe916 100644 --- a/src/Models/Order.php +++ b/src/Models/Order.php @@ -212,6 +212,26 @@ protected function statusName(): Attribute ); } + /** + * Get the payment status name attribute. + * + * @return \Illuminate\Database\Eloquent\Casts\Attribute + */ + protected function paymentStatus(): Attribute + { + return new Attribute( + get: function (): string { + return match (true) { + $this->refunded() => __('Refunded'), + $this->partiallyRefunded() => __('Partially Refunded'), + $this->paid() => __('Paid'), + $this->partiallyPaid() => __('Partially Paid'), + default => __('Pending Payment'), + }; + } + ); + } + /** * Get the columns that should receive a unique identifier. */