private function createSession($sid, $userId, Request $req)
    {
        $sessionCookie = session_get_cookie_params();
        $expires = time() + $sessionCookie['lifetime'];

        $session = new ActiveSession();
        $session->id = $sid;
        $session->user_id = $userId;
        $session->ip = $req->ip();
        $session->user_agent = $req->agent();
        $session->expires = $expires;
        $session->save();

        return $session;
    }
private function createSession($sid, $userId, Request $req)
    {
        $sessionCookie = session_get_cookie_params();
        $expires = time() + $sessionCookie['lifetime'];

        $session = new ActiveSession();
        $session->id = $sid;
        $session->user_id = $userId;
        $session->ip = $req->ip();
        $session->user_agent = $req->agent();
        $session->expires = $expires;
        $session->save();

        return $session;
    }
private function createSession ( $ sid , $ userId , Request $ req ) { $ sessionCookie = session_get_cookie_params ( ) ; $ expires = time ( ) + $ sessionCookie [ 'lifetime' ] ; $ session = new ActiveSession ( ) ; $ session -> id = $ sid ; $ session -> user_id = $ userId ; $ session -> ip = $ req -> ip ( ) ; $ session -> user_agent = $ req -> agent ( ) ; $ session -> expires = $ expires ; $ session -> save ( ) ; return $ session ; }
Creates an active session for a user.

@param string  $sid    session ID
@param int     $userId
@param Request $req

@return ActiveSession
Creates an active session for a user .