mercredi 14 décembre 2016

Laravel - Validator double - ERR_TOO_MANY_REDIRECTS

Hi have more than 1 forms for a payment procedure

Here my payment steps

Step 1 - Form input datas;
Step 2 - Valide data of Step 1;
Step 3 - Form input other datas;
Step 4 - Valide data of Step 2;

In the second validation, if validator fail I return...

return redirect()->back()->withErrors($validator)->withInput();

The problem is that, if the second validation fail, it give me this error int he browser

ERR_TOO_MANY_REDIRECTS


I think is due because it redirect()->back() to previous Step 1 and so to the previous validator... and going in to loop.

Now I'have solved returning a View

return View('staff.cedola', $data)->withErrors($validator);

Is this the right way?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire