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

Commit

Permalink
fix for null values on cast
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkingshott committed Jan 17, 2022
1 parent 99971ee commit 7650574
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/SnowflakeCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ class SnowflakeCast implements CastsAttributes
* Cast the given value.
*
*/
public function get($model, string $key, $value, array $attributes) : string
public function get($model, string $key, $value, array $attributes) : mixed
{
return (string) $value;
return filled($value) ? (string) $value : $value;
}

/**
* Prepare the given value for storage.
*
*/
public function set($model, string $key, $value, array $attributes) : int
public function set($model, string $key, $value, array $attributes) : mixed
{
return (int) $value;
return filled($value) ? (int) $value : $value;
}
}

0 comments on commit 7650574

Please sign in to comment.