Found a way to do it in a dumb manner: loop over each item and create specific validation rules for it. But I would really be happier, if it were possible to do it in a less mundane and verbose way...
Apr 14, 2020
1
Level 1
How to exclude specific items from request validation?
I want to pass an object that has an array of $items to a validator and each of the items would have an action field, which would hold a value of 'deleted' or anything else.
I have complex validation for those items using a wildcard (example: items.*.somefield => 'required'). However, I don't want to apply any validation, if an item has action: 'deleted'. That poses a problem to me because I am using wildcards to access all the items...
I've looked into sometimes rule and documentation, but didn't find any examples fitting the case...
Please or to participate in this conversation.