public static function getUserID()
    {
        $user = Yii::$app->getUser();

        return $user && !$user->getIsGuest() ? $user->getId() : 0;
    }
public static function getUserID()
    {
        $user = Yii::$app->getUser();

        return $user && !$user->getIsGuest() ? $user->getId() : 0;
    }
public static function getUserID ( ) { $ user = Yii :: $ app -> getUser ( ) ; return $ user && ! $ user -> getIsGuest ( ) ? $ user -> getId ( ) : 0 ; }
Get the current user ID

@return int The user ID
Get the current user ID