I would like to set a variable in the session using laravel this way
Session::set('variableName')=$value;
but the problem is that I don't know where to put this code, 'cause I would like to set it for one time (when the guest visite the home page or any other page)? The main idea is to use a global variable to use it in all application controllers, I heared about something related to configuration variables but I'm not sure if it will be a good Idea to use config variables or only the session? Thanks
For example, To store data in the session, you will typically use the
put
method or thesession
helper:or
for retrieving an item from the session, you can use
get
:or global
session
helper :To determine if an item is present in the session, you may use the
has
method: