public function getBaseUrl()
    {
        if ($this->_baseUrl === null) {
            $request = Yii::$app->getRequest();
            if ($request instanceof Request) {
                $this->_baseUrl = $request->getBaseUrl();
            } else {
                throw new InvalidConfigException('Please configure UrlManager::baseUrl correctly as you are running a console application.');
            }
        }

        return $this->_baseUrl;
    }
public function getBaseUrl()
    {
        if ($this->_baseUrl === null) {
            $request = Yii::$app->getRequest();
            if ($request instanceof Request) {
                $this->_baseUrl = $request->getBaseUrl();
            } else {
                throw new InvalidConfigException('Please configure UrlManager::baseUrl correctly as you are running a console application.');
            }
        }

        return $this->_baseUrl;
    }
Returns the base URL that is used by [[createUrl()]] to prepend to created URLs.
It defaults to [[Request::baseUrl]].
This is mainly used when [[enablePrettyUrl]] is `true` and [[showScriptName]] is `false`.
@return string the base URL that is used by [[createUrl()]] to prepend to created URLs.
@throws InvalidConfigException if running in console application and [[baseUrl]] is not configured.