Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Feb 9, 2024
1 parent fa428ce commit e1ccf57
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/advanced-usage/creating-a-cast.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ In the end, the cast should return a casted value.

When the cast is unable to cast the value, an `Uncastable` object should be returned.

## Null

A cast like a transformer never receives a `null` value, this is because the package will always keep a `null` value as `null` because we don't want to create values out of thin air. If you want to replace a `null` value, then use a magic method.

## Castables

You may want to allow your application's value objects to define their own custom casting logic. Instead of attaching the custom cast class to your object, you may alternatively attach a value object class that implements the `Spatie\LaravelData\Casts\Castable` interface:
Expand Down

0 comments on commit e1ccf57

Please sign in to comment.