mardi 16 août 2016

Duplicate User's Session Records in Session Table: Laravel

Sample data in this table looks like below:

enter image description here

There are multiple duplicate User's Session records present in the table.

vendor\laravel\framework\src\Illuminate\Session\DatabaseSessionHandler.php

In the above file path, we have below method

public function write($sessionId, $data)
{
    $payload = $this->getDefaultPayload($data);

    if (! $this->exists) {
        $this->read($sessionId);
    }
    if ($this->exists) {
        $this->getQuery()->where('id', $sessionId)->update($payload);
    } else {
        $payload['id'] = $sessionId;

        $this->getQuery()->insert($payload);
    }

    $this->exists = true;
}

It checks for Session ID.

Question

Can I avoid creation of duplicate User Session Records in Session Table? Is there any flag that do so in Session Config file?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire