mirror of
https://github.com/archtechx/virtualcolumn.git
synced 2025-12-12 14:14:05 +00:00
Use non-lowercase custom cast class strings
This commit is contained in:
parent
4414d11203
commit
85723fe337
1 changed files with 1 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue