|
@@ 170-181 (lines=12) @@
|
| 167 |
|
|
| 168 |
|
if ($field instanceof Field\Embeds) { |
| 169 |
|
// dd($field->column(), $input, $old, $availInput); |
| 170 |
|
$newRules = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
| 171 |
|
list($r, $k, $c) = explode('.', $v); |
| 172 |
|
$v = "{$r}.{$k}"; |
| 173 |
|
$embed = $field->getValidationRules([$field->column() => $availInput[$k][$c]]); |
| 174 |
|
// $embed = $embed ? call_user_func_array( |
| 175 |
|
// 'array_merge', |
| 176 |
|
// array_map(function ($x, $y) { |
| 177 |
|
// return [str_replace('.', ':', $x) => $y]; |
| 178 |
|
// }, array_keys($embed), $embed) |
| 179 |
|
// ) : $embed; |
| 180 |
|
return $embed ? $array_key_attach_str($embed, $v) : null; |
| 181 |
|
}, $newColumn); |
| 182 |
|
$rules = $array_clean_merge($rules, array_filter($newRules)); |
| 183 |
|
|
| 184 |
|
$newAttributes = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
@@ 184-195 (lines=12) @@
|
| 181 |
|
}, $newColumn); |
| 182 |
|
$rules = $array_clean_merge($rules, array_filter($newRules)); |
| 183 |
|
|
| 184 |
|
$newAttributes = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
| 185 |
|
list($r, $k, $c) = explode('.', $v); |
| 186 |
|
$v = "{$r}.{$k}"; |
| 187 |
|
$embed = $field->getValidationAttributes([$field->column() => $availInput[$k][$c]]); |
| 188 |
|
// $embed = $embed ? call_user_func_array( |
| 189 |
|
// 'array_merge', |
| 190 |
|
// array_map(function ($x, $y) { |
| 191 |
|
// return [str_replace('.', ':', $x) => $y]; |
| 192 |
|
// }, array_keys($embed), $embed) |
| 193 |
|
// ) : $embed; |
| 194 |
|
return $embed ? $array_key_attach_str($embed, $v) : null; |
| 195 |
|
}, $newColumn); |
| 196 |
|
$attributes = $array_clean_merge($attributes, array_filter($newAttributes)); |
| 197 |
|
|
| 198 |
|
$newInput = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
@@ 198-209 (lines=12) @@
|
| 195 |
|
}, $newColumn); |
| 196 |
|
$attributes = $array_clean_merge($attributes, array_filter($newAttributes)); |
| 197 |
|
|
| 198 |
|
$newInput = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
| 199 |
|
list($r, $k, $c) = explode('.', $v); |
| 200 |
|
$v = "{$r}.{$k}"; |
| 201 |
|
$embed = $field->getValidationInput([$field->column() => $availInput[$k][$c]]); |
| 202 |
|
// $embed = $embed ? call_user_func_array( |
| 203 |
|
// 'array_merge', |
| 204 |
|
// array_map(function ($x, $y) { |
| 205 |
|
// return [str_replace('.', ':', $x) => $y]; |
| 206 |
|
// }, array_keys($embed), $embed) |
| 207 |
|
// ) : $embed; |
| 208 |
|
return $embed ? $array_key_attach_str($embed, $v) : [null => 'null']; |
| 209 |
|
}, $newColumn); |
| 210 |
|
$newInputs = $array_clean_merge($newInputs, array_filter($newInput, 'strlen', ARRAY_FILTER_USE_KEY)); |
| 211 |
|
|
| 212 |
|
$newMessages = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
@@ 212-225 (lines=14) @@
|
| 209 |
|
}, $newColumn); |
| 210 |
|
$newInputs = $array_clean_merge($newInputs, array_filter($newInput, 'strlen', ARRAY_FILTER_USE_KEY)); |
| 211 |
|
|
| 212 |
|
$newMessages = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
| 213 |
|
list($r, $k, $c) = explode('.', $v); |
| 214 |
|
$v = "{$r}.{$k}"; |
| 215 |
|
$embed = $field->getValidationMessages([$field->column() => $availInput[$k][$c]]); |
| 216 |
|
// $embed = $embed ? call_user_func_array( |
| 217 |
|
// 'array_merge', |
| 218 |
|
// array_map(function ($x, $y) { |
| 219 |
|
// $x = explode('.', $x); |
| 220 |
|
// $x = implode('', array_slice($x, 0, -1)) . '.' . end($x); |
| 221 |
|
// return [$x => $y]; |
| 222 |
|
// }, array_keys($embed), $embed) |
| 223 |
|
// ) : $embed; |
| 224 |
|
return $embed ? $array_key_attach_str($embed, $v) : null; |
| 225 |
|
}, $newColumn); |
| 226 |
|
$messages = $array_clean_merge($messages, array_filter($newMessages)); |
| 227 |
|
// dd($rules, $attributes, $messages, $newInputs); |
| 228 |
|
} else { |