I'm trying to store details about each persons session in the database as shown here: http://laravel.com/docs/4.2/session#database-sessions, and now I have the table migrated and looking all good to go. However, I cannot actually find any documents that give help on how to use this table. I wish to track the last actions of each person and also count the people online.
Can anyone provide examples of usage of the session database, or links to documentation? I assumed that this table would be automatically managed by Laravel, but it appears I am incorrect.
Can anyone provide examples of usage of the session database, or links to documentation? I assumed that this table would be automatically managed by Laravel, but it appears I am incorrect.
The only thing incorrect is your assumption of being incorrect. The session database is a storage engine for Laravel's session system. Once you've setup the database and configured Laravel to use the session database, you can use the syntax in the session docs to save and get data that's associated with each individual user of your web based system.
So, you have step 1 -- your database table created.
Step 2 would be configuring the storage engine by editing
app/config/session.php
and changing this
'driver' => 'file',
into this
'driver' => 'database'
Once you've done that any call to the session's put method (or other "saving data" methods) will store data in this table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With