Register a breadcrumb domain.

@param  string    $name
@param  \Closure  $callback

@return self
762522
public function register($name, Closure $callback)
    {
        $this->checkCallbackName($name);

        $this->callbacks[$name] = $callback;

        return $this;
    }
962586
public function extend($name, Closure $callback)
    {
        $this->parsers[Str::camel($name)] = Str::title($name);

        return parent::extend($name, $callback);
    }
642115
public function route($name, $path, callable $callback)
    {
        // Modifying path from colon parameters /show/:id to bracket parameters /show/{id}
        $path = preg_replace("|(:(\w+))|", '{$2}', $path);

        // if the route is anonymous
        if (!$name) {
            $name = "N".uniqid();
        }

        $map = $this["router"]->getMap();
        $route = $map->route($name, $path, $callback);

        return $route;
    }
1273088
public function addBreadcrumbLink($name, $url = '', $icon = '')
    {
        $this->breadcrumbItems->push((object) ['name' => $name, 'url' => $url, 'icon' => $icon]);
    }
300725
public function addStep($name, $callback)
    {
        $step = $this->factory([
            'Step',
            'wizard'  => $this,
            'template'=> clone $this->stepTemplate,
            'sequence'=> count($this->steps),
        ], $name);

        // add tabs menu item
        $this->steps[] = $this->add($step, 'Step');

        if (!$this->stepCallback->triggered()) {
            $_GET[$this->stepCallback->urlTrigger] = 0;
        }

        if ($step->sequence == $this->currentStep) {
            $step->addClass('active');

            $this->stepCallback->set($callback, [$this]);
        } elseif ($step->sequence < $this->currentStep) {
            $step->addClass('completed');
        }

        if ($step->icon == null) {
            $step->icon = $this->defaultIcon;
        }

        return $step;
    }
521423
public function registerWidget($name, \Closure $callable)
    {
        if (isset($this->widgets[$name])) {
            throw new \InvalidArgumentException(sprintf(
                'A widget by the name "%s" already exists and cannot be overridden.',
                $name
            ));
        }

        $this->widgets[$name] = function (array $params = []) use ($callable) {
            static $instance;
            if (null === $instance) {
                $instance = $callable($params);
            }
            return $instance;
        };
    }
462331
public function addResolver(string $name, callable $callback)
    {
        //if it's a closure, they meant to bind the callback
        if ($callback instanceof Closure) {
            //so there's no scope
            $callback = $callback->bindTo($this, get_class($this));
        }

        $this->getResolverHandler()->register($name, $callback);

        return $this;
    }
872232
public function with($selector, Closure $callback)
    {
        $browser = new static(
            $this->driver, new ElementResolver($this->driver, $this->resolver->format($selector))
        );

        if ($this->page) {
            $browser->onWithoutAssert($this->page);
        }

        if ($selector instanceof Component) {
            $browser->onComponent($selector, $this->resolver);
        }

        call_user_func($callback, $browser);

        return $this;
    }
452801
public function addRuleCallback($name, Callable $callback)
    {
        if (!is_string($name)) {
            throw new \InvalidArgumentException('Rule must be a string');
        }

        $rule = $this->createRuleCallback($name, $callback);
        $this->addRule($rule);
    }
541532
public function register($name, Closure $callback): void
    {
        if ($this->has($name)) {
            $this->callbacks = $this->callbacks->put($name, $this->callbacks->get($name, collect())->push($callback));
        } else {
            $builder = new MenuGenerator();

            $builder->setViewFactory($this->viewFactory);

            $this->menus->put($name, $builder);

            $this->callbacks = $this->callbacks->put($name, $this->callbacks->get($name, collect())->push($callback));
        }
    }
12370
public function add(string $name, callable $callback): self
    {
        if ($this->exists($name)) {
            throw new LogicException(
                'The helper function name "' . $name . '" is already registered.'
            );
        }

        $this->helpers[$name] = $callback;

        return $this;
    }
454362
public function addCrumb(string $name = '', string $href = ''): Breadcrumbs
    {
        $breadcrumb = [
            'name' => $name,
            'href' => $href
        ];
        if (!$this->validateCrumb($breadcrumb)) {
            throw new InvalidArgumentException(
                'Breadcrumbs::addCrumb() only accepts correctly formatted arrays.'
            );
        }

        $crumb = [
            'name' => $name,
            'href' => $href
        ];

        $this->breadcrumbs[] = $crumb;

        return $this;
    }
795764
public function callback(string $name, callable $callback): self
    {
        $this->callbacks[$name] = $callback;
        return $this;
    }
143375
protected function buildBasic($name, Closure $callback = null)
    {
        if ($name instanceof Closure) {
            $callback = $name;
            $name     = null;
        }
        //!empty($name) && $this->legend($name);

        call_user_func($callback, $this);
    }
37786
public function extend($driver, \Closure $callback)
    {
        $this->customCreators[$driver] = $callback->bindTo($this, $this);

        return $this;
    }
364709
public function table($name, $callback = null)
    {   
        if (! $callback instanceof \Closure) {
            throw InvalidArgumentPassedException::isNotClosure();
        }

        $this->setTableName($name);

        $callback($this);
        
        $tableNamePrefixed = $this->getTableNamePrefix($this->getTableName());
        $tableStructure = \substr($this->getColumnsQuery() . $this->getPrimaryKeyQuery(), 0, -2);
        $tableCharsetCollate = $this->getCharacterSetCollate();

        $this->buildCreateTableQuery($tableNamePrefixed, $tableStructure, $tableCharsetCollate);

        $this->flushColumns();
        $this->flushPrimaryKey();
    }
1150801
private function cacheSpammers(Closure $callback)
    {
        return cache()->remember($this->cacheKey, $this->cacheExpires, $callback);
    }