adrema/app/Module/Module.php

36 lines
722 B
PHP
Raw Normal View History

2023-11-16 10:52:57 +01:00
<?php
namespace App\Module;
enum Module: string
{
case BILL = 'bill';
case COURSE = 'course';
public function title(): string
{
return match ($this) {
static::BILL => 'Zahlungs-Management',
static::COURSE => 'Ausbildung',
};
}
/**
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());
}
}