I want to create session based on the $id (unique id). This is for so that when each user enters the web app they will have their own session id and also their own array. But now when i put it in the function and every time i enter the function the session is not being stored and it is overriding the previous session. so how do i modify the code so that all the session will be created for each user in function test().
Here is my code:
public function test()
{
$id = 'new3'; //later on will be auto generate id
$array[$id] = ['one' => 'abc', 'two' => 'def'];
if (!session($id)) {
session($array);
}
dd(session()->all());
}