Don't you need a return like
return redirect('home/dashboard');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey everyone, I have what should be a simple issue that is driving me crazy. I'm using laravel 5.2 with Spark 1.0. I'm trying to redirect the user to a different route after a successful login. I assumed it would be as simple as changing the $redirectTo variable in the LoginController like so:
protected $redirectTo = '/newLoginRoute';
However I've tried this and it continues to use the old route. I've also tried changing the same $redirectTo property in the AuthController, as well as hardcoding it into the RedirectsUsers trait like so:
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/newLoginRoute';
Despite all this, I'm still redirected using the old route.
Can anyone point me in the right direction here? It seems to me that $redirectTo in the LoginController should be what controls this, but since that didn't work I'm really stumped. I have a feeling I overlooked something so I'm hoping another pair of eyes can notice it, thanks!
Edit: per the laravel 5.2 docs, "When a user is successfully authenticated, they will be redirected to the / URI. You can customize the post-authentication redirect location by defining a redirectTo property on the AuthController". I've tried that with no result, did Spark change something?
There is also the intended route - that is, where the user was going when they were caught by middleware and asked to login.
What I have done in the past is not have a dedicated login route, but rather when the user clicks on the login link they are actually clicking on something like /dashboard
Middleware says hey, only authenticated users can go to dashboard, and intercepts the flow. The user logs in and then is directed to the place they were going in the first place such as /dashboard.
So, I would start at the beginning. What were you trying to do when you ended up at the login form?
Please or to participate in this conversation.