Skip to content

Commit

Permalink
add payment status
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Feb 22, 2024
1 parent 2497711 commit c91b71c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,26 @@ protected function statusName(): Attribute
);
}

/**
* Get the payment status name attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
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.
*/
Expand Down

0 comments on commit c91b71c

Please sign in to comment.