title: Laravel redirect to local referer after login
body: <p>Trying to make redirect this way:</p>
  
  <p>in LoginController add function redirectPath</p>
  
  <pre><code>public function redirectPath()
      {
          if (method_exists($this, 'redirectTo')) {
              return $this-&gt;redirectTo();
          }
  
          return property_exists($this, 'redirectTo') ? $this-&gt;redirectTo : '/home';
      }
  </code></pre>
  
  <p>and redirectTo()</p>
  
  <pre><code>public function redirectTo(){
          return '/dynamic_url';
      }
  </code></pre>
  
  <p>How can I set my '/dynamic_url' to path that I came from</p>
  
  <hr>
  
  <p>If add </p>
  
  <p><code>$this-&gt;localReferer =  app('Illuminate\Routing\UrlGenerator')-&gt;previous();</code> </p>
  
  <p>It defines backurl correct, but when I submit login, page reloads and referer changed to '/login'</p>
  
  <p>also tried to set cookie in __construct()</p>
  
  <pre><code>use Cookie;
  ...
  Cookie::make('localreferer', $this-&gt;localReferer, 60);
  </code></pre>
  
  <p>and this does not create a cookie</p>