Laravel 5: why do I get the intermediate page when you was redirected?

Hi all. There is such a code with a simple validation form, which is available on the page:

if($request->filter){

 $v = Validator::make($request->all(), (new Requests\HypothecCalcRequest())->rules(), (new Requests\HypothecCalcRequest())->messages());

 if ($v->fails()){
 return redirect()->back()->withErrors($v->errors());
 } else {
 $calculatorTable = Hypothec::annuitCalculator($request);
}

}

....

 return view('hypothec.index', $params);


The problem is that if the query fails validatio before iredirector user throws to the intermediate page with the content Redirecting to mysite.local, and only then does the redirect.

Tell me, what did I do wrong that there is this intermediate page and why it actually occurs?
July 2nd 19 at 18:23
4 answers
July 2nd 19 at 18:25
How then to redirect the user? - jaleel commented on July 2nd 19 at 18:28
: write your helper, obviously. - vito.Hoeg commented on July 2nd 19 at 18:31
: not obvious. Why create a simple CRUD application, redirect virus, for example, when you save a model, work out without intermediate pages? - jaleel commented on July 2nd 19 at 18:34
July 2nd 19 at 18:27
At me such was because of var_dump
July 2nd 19 at 18:29
Checked, no conclusions echo, var_dump, dump, dd is nothing there. Validation takes place at the beginning of the method, it is not a code.
July 2nd 19 at 18:31
"Intermediate" page appears, if the redirection was not HEAD (GET) method.

That is, in your case when sending data with the POST method and passing the validation you throw a redirect to the GET method and everything is fine...
But if validation does not pass, you do a redirect to the same page but with the POST method.

Roughly speaking, if after you submit the form you press F5 in the browser, it POPs up alert in the browser to resubmit the data? - Must be familiar...

So in this case RedirectResponse makes explicit the GET redirect. If this would not happen, you would not be able to refresh the page after this redirect the browser would issue the alert.
Thank you very much for the clarification! - jaleel commented on July 2nd 19 at 18:34

Find more questions by tags LaravelPHP