From 7b09c945be3ddc67baa88085976c755aae66f85b Mon Sep 17 00:00:00 2001 From: Manuel <64487711+gigerIT@users.noreply.github.com> Date: Wed, 6 Aug 2025 09:11:18 +0200 Subject: [PATCH] feat: support BackedEnum to BackedEnum casting in EnumCast --- src/Casts/EnumCast.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Casts/EnumCast.php b/src/Casts/EnumCast.php index 1895d0c5..24b24e3e 100644 --- a/src/Casts/EnumCast.php +++ b/src/Casts/EnumCast.php @@ -48,7 +48,7 @@ protected function castValue( /** @var class-string<\BackedEnum> $type */ try { - return $type::from($value); + return $type::from($value instanceof \BackedEnum ? $value->value : $value); } catch (Throwable $e) { throw CannotCastEnum::create($type, $value, $property); }