* * @param {*} field * @param {*} value * @param {*} args
(field, value, args)
| 110 | * @param {*} args |
| 111 | */ |
| 112 | async validateRequiredWith(field, value, args) { |
| 113 | |
| 114 | if (!Array.isArray(args)) args = [args]; |
| 115 | |
| 116 | if (!args.length) { |
| 117 | throw new Error('Invalid arguments supplied for field ' + field + ' in required with rule.'); |
| 118 | } |
| 119 | |
| 120 | let i, required = false; |
| 121 | |
| 122 | for (i = 0; i < args.length; ++i) { |
| 123 | |
| 124 | if (args[i] == field) { |
| 125 | continue; |
| 126 | } |
| 127 | |
| 128 | if (!this.isEmpty(this.validator.inputs[args[i]])) { |
| 129 | required = true; |
| 130 | break; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | if (required && this.isEmpty(value)) { |
| 135 | |
| 136 | return false; |
| 137 | } |
| 138 | |
| 139 | return true; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * |