protected function compare($url)
    {
        $activeMenuRouteUrl = $this->getActiveMenuRoute();
        if ($this->url == $url or $url == $activeMenuRouteUrl) {
            return true;
        }
        $segments = $this->segments;
        $count    = count($segments);
        if ($count !== count(array_filter(explode('/', str_replace(url('/'), '', $url))))) {
            return false;
        }

        $segmented = url('/') . '/' . implode('/', array_slice($segments, 0, $count - 1));
        if (count($segments) > 2 && starts_with($url, $segmented)) {
            return true;
        }
        @list($domain, $area, $module, $action) = explode('/', str_replace('http://', '', $url));
        if (!isset($segments[1])) {
            return false;
        }
        return ($segments[1] == $module && isset($segments[2]) && (in_array($segments[2], ['index', 'edit']) or is_numeric($segments[2])));
    }