Same URL, multiple pages

Posted 3 years ago by raphadko

I want to add a functionality on my web app where users visit the same URL and get different pages depending if they are logged in or not. The way I'm doing this now is using a middleware to redirect logged in users to /home. But, I want to do something like facebook does..

When someone types http://facebook.com, it analyzes if the person is logged in, if they are, it shows their home, if they are not, it shows the registration page on the same URL (you can see that the address in the bar does not change)

How can I achieve this on Laravel? Is there a way a middleware can reroute to a different controller method? Would that be the right way to do it?

Please sign in or create an account to participate in this conversation.