Gagandeep
Gagandeep

Reputation: 83

how to create session id in laravel 5.3?

how can we create session_id in laravel 5.3 and store it into mysql database? In PHP we use :

session_id();

for generating session_id.

but how can we create session_id in laravel 5.3? Thanks

Upvotes: 1

Views: 3986

Answers (1)

Mayank Pandeyz
Mayank Pandeyz

Reputation: 26258

Depends on the version of Laravel: Laravel 3:

$session_id = $_COOKIE["laravel_session"];

Laravel 4.0:

Just not versions 4.1 and above:

$session_id = session_id();

Laravel 4.1 (and onwards):

$session_id = Session::getId();

or

$session_id = session()->getId();

Answer in detail

Upvotes: 1

Related Questions