C
C
Cavin March2017-04-06 13:25:04
Laravel
Cavin March, 2017-04-06 13:25:04

Where is the best place to store information in Laravel?

Hello. I need your help, I'm making a website for the Minecraft game project. The task is such, after successful authorization, a person needs to make a choice on which server he plays, and information about which server we need to pull up. In general, his choice needs to be saved somewhere before he leaves the site, and I don’t know where I can do it better .. tell me please) Is it
better to store in cookies, if so, how is it better? Or store it in the session, or if possible somehow, then write the Auth::user() object to the object, such as auth()->user()->server

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
D3lphi, 2017-04-06
@ForbsmC

In session. You can also store in cookies. Everything depends on the task.

V
Victor, 2017-04-06
@v_decadence

You can store in many places. Depends on how critical the loss of this value will be. Cookies, Local Storage and sessions don't last forever, the most reliable thing in a database. Create a server column and go:

$user = Auth::user();
$user->server = "127.0.0.1";
$user->save();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question