adrema/app/Module/Module.php

38 lines
796 B
PHP
Raw Permalink Normal View History

2023-11-16 10:52:57 +01:00
<?php
namespace App\Module;
enum Module: string
{
case BILL = 'bill';
case COURSE = 'course';
2023-11-16 12:14:14 +01:00
case EVENT = 'event';
2023-11-16 10:52:57 +01:00
public function title(): string
{
return match ($this) {
static::BILL => 'Zahlungs-Management',
static::COURSE => 'Ausbildung',
2023-11-16 12:14:14 +01:00
static::EVENT => 'Veranstaltungen',
2023-11-16 10:52:57 +01:00
};
}
/**
2023-11-16 12:07:07 +01:00
* @return array<int, array{id: string, name: string}>
2023-11-16 10:52:57 +01:00
*/
public static function forSelect(): array
{
return array_map(fn ($module) => ['id' => $module->value, 'name' => $module->title()], static::cases());
}
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn ($module) => $module->value, static::cases());
}
}