N
N
Nikolino2018-09-02 05:00:23
Laravel
Nikolino, 2018-09-02 05:00:23

How to return the user to where he went to the login page from?

On pages for unlogged users, instead of the block with comments, there are links to /login and /register. After a successful login, I want to transfer back to the page from which they clicked on the login and switched to the login form.
Created a method in LoginController

protected function redirectTo()
    {
        return redirect()->intended('/');
    }

The docs say it takes precedence over the
protected $redirectTo = '/home';
Or is the indented() method only needed for middleware?
What is the right way to do it in my case?
Do not rewrite the current URL in the session when entering the page every time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vanya Huk, 2018-09-02
@vanyahuk

return Redirect::back();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question