public static function hasUser()
    {

        if (!(Yii::$app instanceof Application)) {
            return false;
        }
        if (!Yii::$app->db->getTableSchema(User::tableName())) {
            return false;
        }
        try {
            $identityClass = Yii::$app->user->identityClass;
        } catch (\Exception $e) {
            $identityClass = false;
        }

        if (!$identityClass) {
            return false;
        }

        return !Yii::$app->user->isGuest;
    }
public static function hasUser()
    {

        if (!(Yii::$app instanceof Application)) {
            return false;
        }
        if (!Yii::$app->db->getTableSchema(User::tableName())) {
            return false;
        }
        try {
            $identityClass = Yii::$app->user->identityClass;
        } catch (\Exception $e) {
            $identityClass = false;
        }

        if (!$identityClass) {
            return false;
        }

        return !Yii::$app->user->isGuest;
    }
public static function hasUser ( ) { if ( ! ( Yii :: $ app instanceof Application ) ) { return false ; } if ( ! Yii :: $ app -> db -> getTableSchema ( User :: tableName ( ) ) ) { return false ; } try { $ identityClass = Yii :: $ app -> user -> identityClass ; } catch ( \ Exception $ e ) { $ identityClass = false ; } if ( ! $ identityClass ) { return false ; } return ! Yii :: $ app -> user -> isGuest ; }
We just check whether module is installed and user is logged in.
@return bool
We just check whether module is installed and user is logged in .