I'm having some issues with protecting routes in Laraval.
So one of my routes: Route::get('/purchase-quote', ['middleware' => 'auth', 'uses' => 'PurchaseController@purchaseQuote']);
Lets say for example, I am on page /about and I click a link that takes me to /purchase-quote. Well it's doing what I want there, it's forcing someone to login or register before accessing the page.
The issue is that after they register, instead of continuing on and taking them to the intended /purchase-quote page, it takes them directly to the home page at /
This used to work the way I am needing it to, and all of a sudden it does not. If I do login instead of register, it works the way it should.
Will also include auth code here:
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->guest()) {
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('register');
}
}
return $next($request);
}