Replies: 1 comment 1 reply
-
If your Cast always will be performed when coming from a request, why not inject the request which contains the company I expect? Otherwise, use a magic method to create the data object and uuid, these are difficult cases which are a bit harder to get right. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a situation where I need to pass arbitrary data to casts and validation rules. I've mostly looked into the Cast for now. I see that you can pass literal values to casts via the attribute but I need the ability to pass a computed value. I don't want to pollute the payload with this data, mostly due to it coming from a request. I've done the following for now:
This works but I'm not a fan of using the payload in this way.
For validation rules, I can't see any way to get arbitrary data at the point the rules are constructed. Any suggestions would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions