title: Laravel : Redirect the user to the same page after login
body: <p>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.</p>
  
  <p>After a successful login, I need to send the user back to same products page again.</p>
  
  <p>I used the following way in login controller.</p>
  
  <p>But it's not actually working the way i want. 
  Means it redirect to the index page again, I have used the <code>return redirect()-&gt;back();</code> also..but doesn't solve the problem</p>
  
  <pre><code>if (auth()-&gt;attempt(array('email' =&gt; $request-&gt;input('email'),
               'password' =&gt; $request-&gt;input('password')))){
   if(Auth::user()-&gt;name == 'Admin'){
                   return redirect()-&gt;to('home');
              }
              else{
             //     return redirect()-&gt;back();
                  return redirect()-&gt;intended('/');
              }
       }
  </code></pre>
  
  <p>How to solve the issue?</p>