protected function makeMenu($menu)
    {
        $links = [];
        foreach ($menu as $key => $item) {
            // Rebuild from associative array
            if (is_string($item)) {
                $item = [$key, $item];
            }

            list($endpoint, $label) = $item;
            $attributes = array_get($item, 4, []);

            // Compute actual URL
            $parameters = array_get($item, 2, []);
            $link = $this->router->getRoutes()->getByName($endpoint)
                ? $this->url->route($endpoint, $parameters)
                : $this->url->to($endpoint, $parameters);

            // Compute active state
            if ($link !== '#') {
                $active = array_get($item, 3) ?: str_replace($this->request->root().'/', null, $link);
                $active = $this->isOnPage($active);
            } else {
                $active = false;
            }

            $links[] = array_merge([
                'endpoint' => $link,
                'label' => $this->translate($label),
                'active' => $active ? 'active' : false,
            ], $attributes);
        }

        return $links;
    }
protected function makeMenu($menu)
    {
        $links = [];
        foreach ($menu as $key => $item) {
            // Rebuild from associative array
            if (is_string($item)) {
                $item = [$key, $item];
            }

            list($endpoint, $label) = $item;
            $attributes = array_get($item, 4, []);

            // Compute actual URL
            $parameters = array_get($item, 2, []);
            $link = $this->router->getRoutes()->getByName($endpoint)
                ? $this->url->route($endpoint, $parameters)
                : $this->url->to($endpoint, $parameters);

            // Compute active state
            if ($link !== '#') {
                $active = array_get($item, 3) ?: str_replace($this->request->root().'/', null, $link);
                $active = $this->isOnPage($active);
            } else {
                $active = false;
            }

            $links[] = array_merge([
                'endpoint' => $link,
                'label' => $this->translate($label),
                'active' => $active ? 'active' : false,
            ], $attributes);
        }

        return $links;
    }
protected function makeMenu ( $ menu ) { $ links = [ ] ; foreach ( $ menu as $ key => $ item ) { // Rebuild from associative array if ( is_string ( $ item ) ) { $ item = [ $ key , $ item ] ; } list ( $ endpoint , $ label ) = $ item ; $ attributes = array_get ( $ item , 4 , [ ] ) ; // Compute actual URL $ parameters = array_get ( $ item , 2 , [ ] ) ; $ link = $ this -> router -> getRoutes ( ) -> getByName ( $ endpoint ) ? $ this -> url -> route ( $ endpoint , $ parameters ) : $ this -> url -> to ( $ endpoint , $ parameters ) ; // Compute active state if ( $ link !== '#' ) { $ active = array_get ( $ item , 3 ) ? : str_replace ( $ this -> request -> root ( ) . '/' , null , $ link ) ; $ active = $ this -> isOnPage ( $ active ) ; } else { $ active = false ; } $ links [ ] = array_merge ( [ 'endpoint' => $ link , 'label' => $ this -> translate ( $ label ) , 'active' => $ active ? 'active' : false , ] , $ attributes ) ; } return $ links ; }
Make a menu from a list of links.

@param array $menu

@return array
Make a menu from a list of links .