diff --git a/src/Casts/LeenooksCarbon.php b/src/Casts/LeenooksCarbon.php index d175b32..72aaba5 100644 --- a/src/Casts/LeenooksCarbon.php +++ b/src/Casts/LeenooksCarbon.php @@ -13,9 +13,9 @@ class LeenooksCarbon implements CastsAttributes * * @param array $attributes */ - public function get(Model $model, string $key, mixed $value, array $attributes): Carbon + public function get(Model $model, string $key, mixed $value, array $attributes): ?Carbon { - return Carbon::create($value); + return $value ? Carbon::create($value) : NULL; } /**