diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index e31464007595..7a9f8822d2f9 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -1188,7 +1188,7 @@ protected function setEnumCastableAttribute($key, $value) $this->attributes[$key] = $this->getStorableEnumValue($value); } else { $this->attributes[$key] = $this->getStorableEnumValue( - $this->getEnumCaseFromValue($enumClass, $value) + $this->getEnumCaseFromValue($enumClass, $value) ); } } @@ -1238,8 +1238,8 @@ protected function getEnumCaseFromValue($enumClass, $value) protected function getStorableEnumValue($value) { return $value instanceof BackedEnum - ? $value->value - : $value->name; + ? $value->value + : $value->name; } /** @@ -1251,7 +1251,7 @@ protected function getStorableEnumValue($value) protected function getStorableEnumArrayValue($value) { return json_encode( - array_map(fn ($value) => $this->getStorableEnumValue($value), $value) + array_map(fn ($value) => $this->getStorableEnumValue($value), $value) ); }