@@ 143-168 (lines=26) @@ | ||
140 | * |
|
141 | * @return array |
|
142 | */ |
|
143 | protected function formatValidationAttribute($input, $label, $column) |
|
144 | { |
|
145 | $new = $attributes = []; |
|
146 | ||
147 | if (is_array($column)) { |
|
148 | foreach ($column as $index => $col) { |
|
149 | $new[$col.$index] = $col; |
|
150 | } |
|
151 | } |
|
152 | ||
153 | foreach (array_keys(Arr::dot($input)) as $key) { |
|
154 | if (is_string($column)) { |
|
155 | if (Str::endsWith($key, ".$column")) { |
|
156 | $attributes[$key] = $label; |
|
157 | } |
|
158 | } else { |
|
159 | foreach ($new as $k => $val) { |
|
160 | if (Str::endsWith($key, ".$k")) { |
|
161 | $attributes[$key] = $label."[$val]"; |
|
162 | } |
|
163 | } |
|
164 | } |
|
165 | } |
|
166 | ||
167 | return $attributes; |
|
168 | } |
|
169 | ||
170 | /** |
|
171 | * Reset input key for validation. |
@@ 207-232 (lines=26) @@ | ||
204 | * |
|
205 | * @return array |
|
206 | */ |
|
207 | protected function formatValidationAttribute($input, $label, $column) |
|
208 | { |
|
209 | $new = $attributes = []; |
|
210 | ||
211 | if (is_array($column)) { |
|
212 | foreach ($column as $index => $col) { |
|
213 | $new[$col.$index] = $col; |
|
214 | } |
|
215 | } |
|
216 | ||
217 | foreach (array_keys(Arr::dot($input)) as $key) { |
|
218 | if (is_string($column)) { |
|
219 | if (Str::endsWith($key, ".$column")) { |
|
220 | $attributes[$key] = $label; |
|
221 | } |
|
222 | } else { |
|
223 | foreach ($new as $k => $val) { |
|
224 | if (Str::endsWith($key, ".$k")) { |
|
225 | $attributes[$key] = $label."[$val]"; |
|
226 | } |
|
227 | } |
|
228 | } |
|
229 | } |
|
230 | ||
231 | return $attributes; |
|
232 | } |
|
233 | ||
234 | /** |
|
235 | * Reset input key for validation. |