Skip to content

Commit dc9cda7

Browse files
robinvalkbarryvdh
authored andcommitted
Change offsetGet to input and file methods (#33)
On some weird occasions some request data is not returned with `offsetGet()`. I initially changed `get()` to `offsetGet()` to support files (and dot notation). But this is unfortunately not a reliable solution. This pr changes `offsetGet()` to `input()` and `file()`, this results in the expected request data.
1 parent b564d44 commit dc9cda7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ValidatesForms.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ trait ValidatesForms
2121
*/
2222
public function validateForm(Form $form, Request $request, array $rules, array $messages = array())
2323
{
24-
$data = $form->getName() ? $request->offsetGet($form->getName()) : $request->all();
24+
$data = $form->getName()
25+
? $request->input($form->getName(), []) + $request->file($form->getName(), [])
26+
: $request->all();
2527
$validator = $this->getValidationFactory()->make($data, $rules, $messages);
2628

2729
$validator->validate();

0 commit comments

Comments
 (0)