/**
  * Make a button.
  *
  * @param  array           $parameters
  * @return ButtonInterface
  */
 public function make(array $parameters)
 {
     $button = array_get($parameters, 'button');
     if ($button && ($registered = $this->buttons->get($button))) {
         $parameters = array_replace_recursive($registered, array_except($parameters, 'button'));
     }
     $parameters = $this->translator->translate($parameters);
     if (!array_get($parameters, 'button') || !class_exists(array_get($parameters, 'button'))) {
         array_set($parameters, 'button', $this->button);
     }
     /* @var ButtonInterface $button */
     $button = app()->make(array_get($parameters, 'button'), $parameters);
     $this->hydrator->hydrate($button, $parameters);
     if (($permission = $button->getPermission()) && !$this->authorizer->authorize($permission)) {
         $button->setEnabled(false);
     }
     return $button;
 }
 /**
  * Make an action.
  *
  * @param  array           $parameters
  * @return ActionInterface
  */
 public function make(array $parameters)
 {
     $parameters = $this->translator->translate($parameters);
     $this->hydrator->hydrate($action = app()->make(array_get($parameters, 'action', $this->action), $parameters), $parameters);
     return $action;
 }
 /**
  * Translate the tree segments.
  *
  * @param TreeBuilder $builder
  */
 public function translate(TreeBuilder $builder)
 {
     $builder->setSegments($this->translator->translate($builder->getSegments()));
 }