Fix casting on compressed attributes when value is NULL, reduce some BINKP debugging messages
This commit is contained in:
@@ -10,15 +10,15 @@ class CompressedString implements CastsAttributes
|
||||
/**
|
||||
* Cast the given value.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param array $attributes
|
||||
* @return string
|
||||
* @param Model $model
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param array $attributes
|
||||
* @return string|null
|
||||
*/
|
||||
public function get($model, string $key, $value, array $attributes): string
|
||||
public function get($model,string $key,$value,array $attributes): ?string
|
||||
{
|
||||
return zstd_uncompress(base64_decode($value));
|
||||
return $value ? zstd_uncompress(base64_decode($value)) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ class CompressedString implements CastsAttributes
|
||||
* @param array $attributes
|
||||
* @return string|null
|
||||
*/
|
||||
public function set($model, string $key, $value, array $attributes): ?string
|
||||
public function set($model,string $key,$value,array $attributes): ?string
|
||||
{
|
||||
return $value ? base64_encode(zstd_compress($value)) : NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user