function currentFullUrl($localeCode = null) { if (empty($localeCode)) { return request()->fullUrl(); } $url_parts = parse_url(request()->fullUrl()); $localizedUrl = LaravelLocalization::getLocalizedUrl($localeCode, null); return $localizedUrl . '?' . $url_parts['query'] . '#' . $url_parts['hash']; }