FIXED - binary csat

This commit is contained in:
Masroor Ehsan 2025-01-08 20:03:41 +06:00
parent 33873729b6
commit 8c109d9719

View File

@ -9,11 +9,21 @@ class Compressed implements CastsAttributes
{ {
public function get(Model $model, string $key, mixed $value, array $attributes): mixed public function get(Model $model, string $key, mixed $value, array $attributes): mixed
{ {
if (blank($value)) {
return null;
}
if (is_resource($value)) {
rewind($value);
$value = stream_get_contents($value);
}
// $value = pg_unescape_bytea($value);
return gzinflate($value); return gzinflate($value);
} }
public function set(Model $model, string $key, mixed $value, array $attributes): mixed public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{ {
return gzdeflate($value); return blank($value) ? null : pg_escape_bytea(gzdeflate($value));
} }
} }