33 lines
847 B
PHP
33 lines
847 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
enum SubscriptionStatus: string
|
|
{
|
|
/** Free plan, or a paid plan whose latest invoice is paid. */
|
|
case Active = 'active';
|
|
|
|
/** A paid plan's invoice was created and is still within its due date. */
|
|
case AwaitingPayment = 'awaiting_payment';
|
|
|
|
/** A paid plan's invoice is overdue; within the grace period. */
|
|
case PastDue = 'past_due';
|
|
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::Active => __('Active'),
|
|
self::AwaitingPayment => __('Awaiting payment'),
|
|
self::PastDue => __('Payment overdue'),
|
|
};
|
|
}
|
|
|
|
public function color(): string
|
|
{
|
|
return match ($this) {
|
|
self::Active => 'emerald',
|
|
self::AwaitingPayment => 'amber',
|
|
self::PastDue => 'red',
|
|
};
|
|
}
|
|
}
|