From 85723fe337d1b58dac8fbe75fb641a3b3c3e6429 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 9 Aug 2023 12:55:02 +0200 Subject: [PATCH] Use non-lowercase custom cast class strings --- src/VirtualColumn.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/VirtualColumn.php b/src/VirtualColumn.php index 9a07e8e..9ee2490 100644 --- a/src/VirtualColumn.php +++ b/src/VirtualColumn.php @@ -37,10 +37,7 @@ trait VirtualColumn $defaultEncryptedCastables = ['encrypted', 'encrypted:array', 'encrypted:collection', 'encrypted:json', 'encrypted:object']; foreach ($model->getAttribute(static::getDataColumn()) ?? [] as $key => $value) { - $keyHasEncryptedCastable = $model->hasCast($key, array_merge( - $defaultEncryptedCastables, - array_map(fn (string $castable) => strtolower($castable), static::$customEncryptedCastables) // hasCast() only works correctly with lowercase strings - )); + $keyHasEncryptedCastable = $model->hasCast($key, array_merge($defaultEncryptedCastables, static::$customEncryptedCastables)); if ($keyHasEncryptedCastable && static::valueEncrypted($value)) { $model->attributes[$key] = $value;