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?
inside your middleware or construct() method, you need to check the URL is it the page or not. If it is the current page, you need to skip the redirect.
Below is the example, I hope you get the idea.
//if under verificated page no need check to avoid keep redirect
if (!request()->is('member/verified-profile'))
{
//check Member Porfile Verification
$this->beforeFilter('@checkUserProfileVerification');
if (!request()->is('member/verified-mobile'))
{
//check Member Mobile Verification
$this->beforeFilter('@checkUserMobileVerification');
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.