Skip to content

Commit f1dac23

Browse files
committed
chore: Write out where the problem occur and the preliminary solution.
1 parent 15b2ea4 commit f1dac23

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

system/Validation/Validation.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,17 @@ public function run(?array $data = null, ?string $group = null, ?string $dbGroup
168168
}
169169

170170
if (strpos($field, '*') !== false) {
171+
172+
// The solution I think is check whether the rule is required and the field is match with the whole array amount.
173+
// If it isn't, We need to fill it up.
174+
// But seems there is the better way?
175+
if (in_array('required', $rules, true) === true) {
176+
dd($data, $field);
177+
}
178+
179+
// The problem occurs here.
180+
// It'll filter out the array that follow the rule.
181+
// And the after code will all use the filtered array.
171182
$values = array_filter(array_flatten_with_dots($data), static fn ($key) => preg_match(
172183
'/^'
173184
. str_replace(['\.\*', '\*\.'], ['\..+', '.+\.'], preg_quote($field, '/'))

0 commit comments

Comments
 (0)