Introduction
You can easily cast your DTO properties by defining a casts method in your DTO:
Alternatively, for simpler cases, you can use the Cast
attribute:
If you're using attributes to define the casting of your properties or if you don't have any casting for the properties, you can use the EmptyCasts
trait to avoid having to define the casts()
method.
Last updated