I have a cart products page, if a person clicks on a product add to cart button they will be redirected to the login page.
After a successful login, I need to send the user back to same products page again.
I used the following way in login controller.
But it's not actually working the way i want. Means it redirect to the index page again, I have used the return redirect()->back();
if (auth()->attempt(array('email' => $request->input('email'),
'password' => $request->input('password'))))
if(Auth::user()->name == 'Admin'){
return redirect()->to('home');
}
else{
// return redirect()->back();
return redirect()->intended('/');
}
How to solve the issue?
via User57