Uh oh!
There was an error while loading. Please reload this page.
feat: [Validation] add field_exists rule - #8123
Conversation
| ?string $error = null, | ||
| ?string $field = null | ||
| ): bool { | ||
| return array_key_exists($field, $data); |
There was a problem hiding this comment.
Ah, we need to handle the key with dot array syntax?
There was a problem hiding this comment.
Good call, I'm afraid so. See required_without above. May be worth having a private method for $data transformations.
There was a problem hiding this comment.
Ah, I see your next PR - much better solution.
673ff74 to
eda462aCompareI believe we would also need versions
|
kenjis
commented
Nov 9, 2023
Really? |
michalsn
commented
Nov 11, 2023
Sorry, I forgot about this one. Example... an API with a custom payload? Some optional fields depend on selected parameters. They're not required though. I think I saw a request like this a long time ago, but I can't find it now. |
kenjis
commented
Nov 12, 2023
I think we can use
If it is not required, then it is okay that the key does not exists in the data. If it is required, and the value may be null, empty string, then we need |
f24c53a to
cfa4fa1Compare
MGatner
left a comment
There was a problem hiding this comment.
Looks good to me. I think starting here makes sense and if we find need for additional related rules they can follow.
Needs #8131Description
For #8006
Checklist: