layer-chicken/app/Enums/IsPaid.php

32 lines
593 B
PHP

<?php
namespace App\Enums;
use App\Traits\Enum\WithComment;
use App\Traits\Enum\WithValue;
enum IsPaid: string
{
use WithComment, WithValue;
case PAID = 'Sudah Dibayar';
case NOT_PAID = 'Belum Dibayar';
public function getLabel(): string
{
return $this->value;
}
public function isPaid(self $status): bool
{
return $this === $status;
}
public static function options(): array
{
return collect(self::cases())
->mapWithKeys(fn ($case) => [$case->value => $case->getLabel()])
->toArray();
}
}