I'm having a weird issue with a redirect not actually changing the url. In my application, I have:
return redirect()->route('training');
And verified that that route works and exists. When I hit the controller that should handle the redirect, I get a message that says "Aw snap" and the page doesn't change.
However, when I look chrome dev tools, it looks like it is trying to go to /training and it is a 200. But nothing is actually happening in the application itself.
Thanks for the reply. It's a pretty simple method:
{
$credentials = $request->validate([
'email' => ['required'],
'password' => ['required'],
]);
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
return redirect()->route('training');
}
return redirect()->route('login')->withErrors([
'email' => 'The provided credentials do not match our records.',
])->onlyInput('email');
}
I think it's something Javascript related but I can't fathom what it would be. Once it attempts to load the training page this way, if I navigate there manually, it works fine.
I should clarify, the aw snap shows up in a red button, not on the page itself. When I look at the request in the dev tools, it looks like the html is there but none of the styles.
Ah, authentication. I believe that page is erroring because of too many redirects (but not necessarily). Reconfiguring the default authentication has been tricky for me in the past too. What version of Laravel are you using?
If you're using other defaults with login, there's a protected $redirectTo variable you can set upon successful authentication.