dress/app/Enums/PriceType.php

32 lines
719 B
PHP

<?php
namespace App\Enums;
enum PriceType: string
{
case PURCHASE = 'purchase';
case DISTRIBUTOR = 'distributor';
case AGENT = 'agent';
case RESELLER = 'reseller';
case RETAIL = 'retail';
public function label(): string
{
return match ($this) {
self::PURCHASE => 'Beli',
self::DISTRIBUTOR => 'Distributor',
self::AGENT => 'Agen',
self::RESELLER => 'Reseller',
self::RETAIL => 'Retail',
};
}
public static function options(): array
{
return collect(self::cases())->map(fn ($case) => [
'value' => $case->value,
'label' => $case->label(),
])->toArray();
}
}