40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Filament\Support\Contracts\HasColor;
|
|
use Filament\Support\Contracts\HasLabel;
|
|
|
|
enum PaymentTransactionStatus: string implements HasColor, HasLabel
|
|
{
|
|
case PENDING = 'pending';
|
|
case PAID = 'paid';
|
|
case CREDITED = 'credited';
|
|
case FAILED = 'failed';
|
|
case IGNORED = 'ignored';
|
|
case ERROR = 'error';
|
|
|
|
public function getLabel(): string
|
|
{
|
|
return match ($this) {
|
|
self::PENDING => __('enums.payment_transaction_status.pending'),
|
|
self::PAID => __('enums.payment_transaction_status.paid'),
|
|
self::CREDITED => __('enums.payment_transaction_status.credited'),
|
|
self::FAILED => __('enums.payment_transaction_status.failed'),
|
|
self::IGNORED => __('enums.payment_transaction_status.ignored'),
|
|
self::ERROR => __('enums.payment_transaction_status.error'),
|
|
};
|
|
}
|
|
|
|
public function getColor(): string
|
|
{
|
|
return match ($this) {
|
|
self::PENDING => 'gray',
|
|
self::PAID => 'info',
|
|
self::CREDITED => 'success',
|
|
self::FAILED, self::ERROR => 'danger',
|
|
self::IGNORED => 'warning',
|
|
};
|
|
}
|
|
}
|