Skip to content

Commit 6fee3a0

Browse files
committed
Fixed immutable NULL date casting
1 parent b0a2117 commit 6fee3a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Casts/ImmutableTimezonedDatetime.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ class ImmutableTimezonedDatetime extends TimezonedDatetime
1515
*/
1616
public function get($model, $key, $value, $attributes)
1717
{
18-
return parent::get($model, $key, $value, $attributes)->toImmutable();
18+
if($date = parent::get($model, $key, $value, $attributes)) {
19+
return $date->toImmutable();
20+
}
21+
22+
return $date;
1923
}
2024
}

0 commit comments

Comments
 (0)