public function prepare()
    {
        $id = $this->getAttribute('id');
        $menus = $this->menu['with'] ?? [];
        $parent = $this->getAttribute('position');
        $position = Str::startsWith($parent, '^:') ? $parent.'.' : '^:';

        foreach ((array) $menus as $class) {
            $menu = $this->container->make($class)
                            ->setAttribute('position', "{$position}{$id}")
                            ->prepare();

            if ($menu->passes()) {
                $this->childs[] = $menu;
            }
        }

        $this->name = $id;
        $this->showToUser = $this->passesAuthorization();

        return $this;
    }
public function prepare()
    {
        $id = $this->getAttribute('id');
        $menus = $this->menu['with'] ?? [];
        $parent = $this->getAttribute('position');
        $position = Str::startsWith($parent, '^:') ? $parent.'.' : '^:';

        foreach ((array) $menus as $class) {
            $menu = $this->container->make($class)
                            ->setAttribute('position', "{$position}{$id}")
                            ->prepare();

            if ($menu->passes()) {
                $this->childs[] = $menu;
            }
        }

        $this->name = $id;
        $this->showToUser = $this->passesAuthorization();

        return $this;
    }
public function prepare ( ) { $ id = $ this -> getAttribute ( 'id' ) ; $ menus = $ this -> menu [ 'with' ] ?? [ ] ; $ parent = $ this -> getAttribute ( 'position' ) ; $ position = Str :: startsWith ( $ parent , '^:' ) ? $ parent . '.' : '^:' ; foreach ( ( array ) $ menus as $ class ) { $ menu = $ this -> container -> make ( $ class ) -> setAttribute ( 'position' , "{$position}{$id}" ) -> prepare ( ) ; if ( $ menu -> passes ( ) ) { $ this -> childs [ ] = $ menu ; } } $ this -> name = $ id ; $ this -> showToUser = $ this -> passesAuthorization ( ) ; return $ this ; }
Prepare nested menu.

@return $this
Prepare nested menu .