Sometimes you have a data object with properties which shouldn’t always be set, for example in a partial API update where you only want to update certain fields. In this case you can make a propertyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/spatie/laravel-data/llms.txt
Use this file to discover all available pages before exploring further.
Optional as such:
artist will automatically be set to Optional. When you transform this data object to an array, it will look like this:
Optional properties are automatically excluded from the array representation when they are not set.
Manual Optional Values
You can manually useOptional values within magical creation methods as such:
Converting Optional to Null
It is possible to automatically updateOptional values to null:
You can read more about this here.