src/models/Visitor.php
public function hasUserId()
    {
        if (Yii::$app->user->isGuest) {
            return $this->user_id !== 0;
        }
        return $this->user_id == Yii::$app->user->identity->getId();
    }
public function hasUserId()
    {
        if (Yii::$app->user->isGuest) {
            return $this->user_id !== 0;
        }
        return $this->user_id == Yii::$app->user->identity->getId();
    }
public function hasUserId ( ) { if ( Yii :: $ app -> user -> isGuest ) { return $ this -> user_id !== 0 ; } return $ this -> user_id == Yii :: $ app -> user -> identity -> getId ( ) ; }
Detect is visitor connected with User

@return bool
Detect is visitor connected with User