35 lines
744 B
PHP
35 lines
744 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use App\Traits\Enum\WithComment;
|
|
use App\Traits\Enum\WithValue;
|
|
use Filament\Support\Contracts\HasLabel;
|
|
|
|
enum MediaType: int implements HasLabel
|
|
{
|
|
use WithComment, WithValue;
|
|
|
|
case ONLINE = 1;
|
|
case PRINT = 2;
|
|
case RADIO = 3;
|
|
case TELEVISION = 4;
|
|
|
|
public function getLabel(): ?string
|
|
{
|
|
return match ($this) {
|
|
self::ONLINE => 'Online',
|
|
self::PRINT => 'Cetak',
|
|
self::RADIO => 'Radio',
|
|
self::TELEVISION => 'Televisi',
|
|
};
|
|
}
|
|
|
|
public static function options(): array
|
|
{
|
|
return collect(self::cases())
|
|
->mapWithKeys(fn ($case) => [$case->value => $case->getLabel()])
|
|
->toArray();
|
|
}
|
|
}
|