cases() */ trait TranslatableTrait { /** * Override this method in the enum to provide custom label mappings. * Keys must be case names (e.g. self::Active->name). * * @return array */ protected static function labels(): array { return []; } /** * Returns the human-readable label for this case. * Falls back to the case name if no label is configured. */ public function label(): string { return static::labels()[$this->name] ?? $this->name; } /** * Returns all cases mapped to their labels. * * @return array [caseName => label] */ public static function labelsArray(): array { $labels = []; foreach (static::cases() as $case) { $labels[$case->name] = $case->label(); } return $labels; } }