Laravel redirect back to original destination after login

This seems like a pretty basic flow, and Laravel has so many nice solutions for basic things, I feel like I’m missing something.

A user clicks a link that requires authentication. Laravel’s auth filter kicks in and routes them to a login page. User logs in, then goes to the original page they were trying to get to before the ‘auth’ filter kicked in.

Is there a good way to know what page they were trying to get to originally? Since Laravel is the one intercepting the request, I didn’t know if it keeps track somewhere for easy routing after the user logs in.

If not, I’d be curious to hear how some of you have implemented this manually.

25 Answers
25

Leave a Comment