Skip to content

Commit

Permalink
chore: Write out where the problem occur and the preliminary solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-yee committed Oct 30, 2023
1 parent 6c06f84 commit fbe9df3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions system/Validation/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ public function run(?array $data = null, ?string $group = null, ?string $dbGroup
}

if (strpos($field, '*') !== false) {

// The solution I think is check whether the rule is required and the field is match with the whole array amount.
// If it isn't, We need to fill it up.
// But seems there is the better way?
if (in_array('required', $rules, true) === true) {
dd($data, $field);
}

// The problem occurs here.
// It'll filter out the array that follow the rule.
// And the after code will all use the filtered array.
$values = array_filter(array_flatten_with_dots($data), static fn ($key) => preg_match(
'/^'
. str_replace(['\.\*', '\*\.'], ['\..+', '.+\.'], preg_quote($field, '/'))
Expand Down

0 comments on commit fbe9df3

Please sign in to comment.