Replies: 1 comment 2 replies
-
Magic creation functions should solve this problem: https://spatie.be/docs/laravel-data/v1/as-a-data-transfer-object/creating-a-data-object#magical-creation. You can just type a request as the parameter and then set the properties correctly into the data object. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to automatically cast values when they are, for example, properties of an object inside your payload?
let's say in my example
title
andartist
are properties ofsong
object.. readable by laravel asrequest('song.title')
andrequest('song.artist')
If the autobinding is not possible, what's the suggested workaround?
Beta Was this translation helpful? Give feedback.
All reactions