| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
-
- namespace App\Enums;
-
- enum StoreCategory: string
- {
- case Fashion = 'fashion';
- case Beauty = 'beauty';
- case Food = 'food';
- case Home = 'home';
- case Electronics = 'electronics';
- case Health = 'health';
- case Kids = 'kids';
- case Digital = 'digital';
- case Other = 'other';
-
- public function label(): string
- {
- return match ($this) {
- self::Fashion => 'Fashion & apparel',
- self::Beauty => 'Beauty & skincare',
- self::Food => 'Food & beverage',
- self::Home => 'Home & living',
- self::Electronics => 'Electronics & gadgets',
- self::Health => 'Health & wellness',
- self::Kids => 'Baby & kids',
- self::Digital => 'Digital products',
- self::Other => 'Other',
- };
- }
-
- /**
- * Options for a select input.
- *
- * @return list<array{value: string, label: string}>
- */
- public static function options(): array
- {
- return array_map(
- fn (self $category) => ['value' => $category->value, 'label' => $category->label()],
- self::cases(),
- );
- }
- }
|