simedkom/app/Enums/ContentType.php

35 lines
755 B
PHP

<?php
namespace App\Enums;
use App\Traits\Enum\WithComment;
use App\Traits\Enum\WithValue;
use Filament\Support\Contracts\HasLabel;
enum ContentType: string implements HasLabel
{
use WithComment, WithValue;
case FOTO = 'Foto';
case TEXT = 'Teks';
case GRAPHIC = 'Grafis';
case VIDEO = 'Video';
public function getLabel(): ?string
{
return match ($this) {
self::FOTO => 'Foto',
self::TEXT => 'Teks',
self::GRAPHIC => 'Grafis',
self::VIDEO => 'Video',
};
}
public static function options(): array
{
return collect(self::cases())
->mapWithKeys(fn ($case) => [$case->value => $case->getLabel()])
->toArray();
}
}