public function setActiveFromUrl(string $url, string $root = '/')
    {
        $this->applyToAll(function (Menu $menu) use ($url, $root) {
            $menu->setActiveFromUrl($url, $root);
        });

        $this->applyToAll(function (Activatable $item) use ($url, $root) {
            $item->determineActiveForUrl($url, $root);
        });

        return $this;
    }
public function setActiveFromUrl(string $url, string $root = '/')
    {
        $this->applyToAll(function (Menu $menu) use ($url, $root) {
            $menu->setActiveFromUrl($url, $root);
        });

        $this->applyToAll(function (Activatable $item) use ($url, $root) {
            $item->determineActiveForUrl($url, $root);
        });

        return $this;
    }
public function setActiveFromUrl ( string $ url , string $ root = '/' ) { $ this -> applyToAll ( function ( Menu $ menu ) use ( $ url , $ root ) { $ menu -> setActiveFromUrl ( $ url , $ root ) ; } ) ; $ this -> applyToAll ( function ( Activatable $ item ) use ( $ url , $ root ) { $ item -> determineActiveForUrl ( $ url , $ root ) ; } ) ; return $ this ; }
Set all relevant children active based on the current request's URL.

/, /about, /contact => request to /about will set the about link active.

/en, /en/about, /en/contact => request to /en won't set /en active if the
request root is set to /en.

@param string $url  The current request url.
@param string $root If the link's URL is an exact match with the request
root, the link won't be set active. This behavior is
to avoid having home links active on every request.

@return $this
Set all relevant children active based on the current request s URL .