From e841fe2930067ebe26b714f6fb9a9ed7258ca8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Fri, 26 Apr 2024 10:40:17 +0200 Subject: [PATCH] handle enum values --- src/Fields/Select.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Fields/Select.php b/src/Fields/Select.php index ab958531..c6418db5 100644 --- a/src/Fields/Select.php +++ b/src/Fields/Select.php @@ -2,6 +2,7 @@ namespace Cone\Root\Fields; +use BackedEnum; use Closure; use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; @@ -72,6 +73,8 @@ public function resolveFormat(Request $request, Model $model): ?string return Collection::make($value) ->map(static function (mixed $value) use ($options): string { + $value = $value instanceof BackedEnum ? $value->value : $value; + return $options[$value] ?? $value; }) ->implode(', ');