@@ 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(array_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. |
@@ 178-203 (lines=26) @@ | ||
175 | * |
|
176 | * @return array |
|
177 | */ |
|
178 | protected function formatValidationAttribute($input, $label, $column) |
|
179 | { |
|
180 | $new = $attributes = []; |
|
181 | ||
182 | if (is_array($column)) { |
|
183 | foreach ($column as $index => $col) { |
|
184 | $new[$col.$index] = $col; |
|
185 | } |
|
186 | } |
|
187 | ||
188 | foreach (array_keys(array_dot($input)) as $key) { |
|
189 | if (is_string($column)) { |
|
190 | if (Str::endsWith($key, ".$column")) { |
|
191 | $attributes[$key] = $label; |
|
192 | } |
|
193 | } else { |
|
194 | foreach ($new as $k => $val) { |
|
195 | if (Str::endsWith($key, ".$k")) { |
|
196 | $attributes[$key] = $label."[$val]"; |
|
197 | } |
|
198 | } |
|
199 | } |
|
200 | } |
|
201 | ||
202 | return $attributes; |
|
203 | } |
|
204 | ||
205 | /** |
|
206 | * Reset input key for validation. |