Cast
Last updated
Last updated
The Cast
attribute allows you to cast your model's public properties to a specific type and also to type your public properties. It works the same way as it would be using the casts
property on your model, but you can set it directly on your public properties.
For the casting to work properly with your public properties, you need to use these helper methods that are available in your Lift model:
A replacement for the create
method. It will cast your public properties and create a new model instance.
A replacement for the fill
method. It will cast your public properties and fill the model instance.
This can be used to cast and set a single public property.
A replacement for the update
method. It will cast your public properties and update the model instance.