Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Commit 7650574

Browse files
committed
fix for null values on cast
1 parent 99971ee commit 7650574

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/SnowflakeCast.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ class SnowflakeCast implements CastsAttributes
1010
* Cast the given value.
1111
*
1212
*/
13-
public function get($model, string $key, $value, array $attributes) : string
13+
public function get($model, string $key, $value, array $attributes) : mixed
1414
{
15-
return (string) $value;
15+
return filled($value) ? (string) $value : $value;
1616
}
1717

1818
/**
1919
* Prepare the given value for storage.
2020
*
2121
*/
22-
public function set($model, string $key, $value, array $attributes) : int
22+
public function set($model, string $key, $value, array $attributes) : mixed
2323
{
24-
return (int) $value;
24+
return filled($value) ? (int) $value : $value;
2525
}
2626
}

0 commit comments

Comments
 (0)