I am confused why it is prerequisite of creating a database table for session based on the documentation, when session can work without it (db table).
Someone could explain me,
session(['key' => 'value']);
without the table, why we need to create a database table for session (based on documentation)?There is a thing called Redis
. what is the purpose? and how to I use (I already installed)?
What are the purpose of the fields like user_id
, ip_address
, user_agent
, payload
, last_activity
? and how can these be useful?
The database and redis are just drivers to be used for storing session. By default laravel uses file
driver which means you can still use session(['key' => 'value']);
and that will be stored in file.
If you chose to use the database then you will need to create the tables which Laravel then uses to store those value in.
Redis is also a completely separate driver, and here is the wiki for it:
Redis is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability.
So in conclusion you should chose which driver to use for your needs.