Laravel link with session
I’m building a website with two season versions: winter and summer.
Now I have unordered lists with two links: winter and summer. Let’s call it season navigation.
<ul class="season-navigation">
<li><a href="/">Winter</a></li>
<li><a href="/summer">Summer</a></li>
</ul>
The user opens the website. The default version now is winter and when it goes to some inner pages and after clicking the main logo of the website, it will take it to the winter homepage, like every website does.
But if a user clicks on the summer link and enter some inner pages and then clicks on the main logo of the website, I want the user to be taken to the summer homepage, not the winter homepage.
As far as I know, Laravel has very good API for sessions, but I’m not sure how to use them in this case.
My question is: when a user clicks on one of the season links, how to store that in session, so when clicks on the main logo of the website to be taken to homepage of the selected season navigation link?
Also, how to add class to the body (winter or summer) that depends from which link is clicked on the season navigation ?
from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-link-with-session/
via Lzo Media
No comments:
Post a Comment