Skip to content

Commit

Permalink
Fixed immutable NULL date casting
Browse files Browse the repository at this point in the history
  • Loading branch information
toonvandenbos committed Dec 15, 2022
1 parent b0a2117 commit 6fee3a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Casts/ImmutableTimezonedDatetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class ImmutableTimezonedDatetime extends TimezonedDatetime
*/
public function get($model, $key, $value, $attributes)
{
return parent::get($model, $key, $value, $attributes)->toImmutable();
if($date = parent::get($model, $key, $value, $attributes)) {
return $date->toImmutable();
}

return $date;
}
}

0 comments on commit 6fee3a0

Please sign in to comment.