original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Prepare nested menu.
  
  @return $this
docstring_tokens: Prepare nested menu .