simedkom/app/Enums/MediaClassification.php

33 lines
700 B
PHP

<?php
namespace App\Enums;
use App\Traits\Enum\WithComment;
use App\Traits\Enum\WithValue;
use Filament\Support\Contracts\HasLabel;
enum MediaClassification: int implements HasLabel
{
use WithComment, WithValue;
case LOCAL = 1;
case REGIONAL = 2;
case NATIONAL = 3;
public function getLabel(): ?string
{
return match ($this) {
self::LOCAL => 'Lokal',
self::REGIONAL => 'Regional',
self::NATIONAL => 'Nasional',
};
}
public static function options(): array
{
return collect(self::cases())
->mapWithKeys(fn ($case) => [$case->value => $case->getLabel()])
->toArray();
}
}