Session is use to storing the user information across the multiple user requests.The session configuration file is stored at config/session.php.

Storing Session Data

To store the session we use the put() method or the session helper.The put() method will take two arguments key and value.

    // Via a request instance...
    $request->session()->put('key', 'value');

    // Via the global helper...
    session(['key' => 'value']);

Retrieve Session Data

The get() method is use to take one argument key to get the session data. The all() method is used get all session data.

    //Retrieve a single key..

    //Retrieve a all key..

Deleting Data

The forget() method will remove a piece of data from the session. If you would like to remove all data from the session you can use the flush() method.

    // Forget a single key...

    // Forget multiple keys...
    $request->session()->forget(['key1', 'key2']);