Create Enum for Invoice type codes and build a translatable Trait.

This commit is contained in:
2025-01-31 13:02:14 +01:00
parent b887899dfc
commit 69c0222cc6
2 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Enum;
trait hasTranslatable
{
public static function options(): array
{
$options = [];
foreach (self::cases() as $value) {
$options[$value->value] = __('enum.' . $value->name);
}
return $options;
}
public static function label($value)
{
return self::options()[$value];
}
}