Answer the question
In order to leave comments, you need to log in
How to store data for unauthorized user in Laravel?
Hello!
I'm working on a specific project in which I need to save some information about the user even before the user logs in. For example, it could be a city. Case from the head: the user entered the site, the system automatically determined the city and saved it. Accordingly, if she made a mistake, the user can change his city and the system will also remember it.
The thought occurred to me that it is possible to store anonymous users in the database, making email, password and username optional, but this looks like a crutch and I don’t want to do this yet. I'm sure there is a best practice for this.
PS In the process of writing the question, the idea came to implement this through sessions or cookies, but again I'm not sure what I think in the right way.
I will be glad to any advice and solutions.
Answer the question
In order to leave comments, you need to log in
Yes that's right. Sessions are used for this. You can also extend the session lifetime in the config/session.php configuration.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question