From 8acc3a91af7e4ce622aec60934a2f942b4a19eda Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 31 Jul 2024 22:40:35 +1000 Subject: [PATCH] Enable NULLs in LeenooksCarbon cast --- src/Casts/LeenooksCarbon.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } /**