src/Mcamara/LaravelLocalization/LaravelLocalization.php
protected function findTranslatedRouteByUrl($url, $attributes, $locale)
    {
        if (empty($url)) {
            return false;
        }

        if (isset($this->cachedTranslatedRoutesByUrl[$locale][$url])) {
            return $this->cachedTranslatedRoutesByUrl[$locale][$url];
        }

        // check if this url is a translated url
        foreach ($this->translatedRoutes as $translatedRoute) {
            $routeName = $this->getURLFromRouteNameTranslated($locale, $translatedRoute, $attributes);

            // We can ignore extra url parts and compare only their url_path (ignore arguments that are not attributes)
            if (parse_url($this->getNonLocalizedURL($routeName), PHP_URL_PATH) == parse_url($this->getNonLocalizedURL($url), PHP_URL_PATH)) {
                $this->cachedTranslatedRoutesByUrl[$locale][$url] = $translatedRoute;

                return $translatedRoute;
            }
        }

        return false;
    }
protected function findTranslatedRouteByUrl($url, $attributes, $locale)
    {
        if (empty($url)) {
            return false;
        }

        if (isset($this->cachedTranslatedRoutesByUrl[$locale][$url])) {
            return $this->cachedTranslatedRoutesByUrl[$locale][$url];
        }

        // check if this url is a translated url
        foreach ($this->translatedRoutes as $translatedRoute) {
            $routeName = $this->getURLFromRouteNameTranslated($locale, $translatedRoute, $attributes);

            // We can ignore extra url parts and compare only their url_path (ignore arguments that are not attributes)
            if (parse_url($this->getNonLocalizedURL($routeName), PHP_URL_PATH) == parse_url($this->getNonLocalizedURL($url), PHP_URL_PATH)) {
                $this->cachedTranslatedRoutesByUrl[$locale][$url] = $translatedRoute;

                return $translatedRoute;
            }
        }

        return false;
    }
Returns the translated route for an url and the attributes given and a locale.


@param string|false|null $url        Url to check if it is a translated route
@param array             $attributes Attributes to check if the url exists in the translated routes array
@param string            $locale     Language to check if the url exists

@throws SupportedLocalesNotDefined
@throws UnsupportedLocaleException

@return string|false Key for translation, false if not exist