Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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