A
A
Alexander Ablizin2016-07-25 12:45:09
Laravel
Alexander Ablizin, 2016-07-25 12:45:09

Larevel 5.2 - How to store values ​​in session with database driver?

Hello, please help me to understand.
Now the application on Laravel v5.2.39 uses "file" as a driver and accordingly stores session data in files at the address "storage/framework/sessions". I switched the session driver to "database" in the settings, having previously created the sessions table

Schema::create('sessions', function ($table) {
  $table->string('id')->unique();
  $table->text('payload');
  $table->integer('last_activity');
});

Now query sessions are created in this table, but how can we save some values ​​now? For example, the method
Session::put('foo', $foo);
does not work, and it does not seem that in the table for sessions it was supposed to store an array of values. Where did I not read the documentation? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2016-07-25
@mcmraak

The table structure has changed -  https://laravel.com/docs/5.2/session , maybe that's the point.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question