Create a group with specific options

@param array $options
@param \Closure $closure
760274
public function group(array $options, \Closure $closure)
	{
		$group = new static(null, $options);

		$closure->bindTo($group)->__invoke($group);

		$this->getCollection()->addAll($group->getCollection());

		return $this;

	}
51693
public function create(array $options)
    {
        $paths = [];

        $nsplaceholder = (!empty($options['namespace']) ? "namespace " . $options['namespace'] . ";" : '');

        $closureInterface = $options['closure'] . 'Interface';
        $qualifiedEntityName = $options['entity'];
        $qualifiedEntityInterfaceName = $qualifiedEntityName . 'Interface';
        $qualifiedClosureName = $options['closure'];
        $qualifiedClosureInterfaceName = $qualifiedClosureName . 'Interface';

        // First, we make entity classes
        $paths[] = $path = $this->getPath($qualifiedEntityName, $options['models-path']);
        $stub = $this->getStub('entity', 'models');

        $this->filesystem->put($path, $this->parseStub($stub, [
            'namespace' => $nsplaceholder,
            'entity_class' => $options['entity'],
            'entity_table' => $options['entity-table'],
            'closure_class' => $options['namespace'] . '\\' . $options['closure'],
            'closure_class_short' => $options['closure'],
            'closure_interface' => $closureInterface
        ]));

        $paths[] = $path = $this->getPath($qualifiedEntityInterfaceName, $options['models-path']);
        $stub = $this->getStub('entityinterface', 'models');

        $this->filesystem->put($path, $this->parseStub($stub, [
            'namespace' => $nsplaceholder,
            'entity_class' => $options['entity']
        ]));

        // Second, we make closure classes
        $paths[] = $path = $this->getPath($qualifiedClosureName, $options['models-path']);
        $stub = $this->getStub('closuretable', 'models');

        $this->filesystem->put($path, $this->parseStub($stub, [
            'namespace' => $nsplaceholder,
            'closure_class' => $options['closure'],
            'closure_table' => $options['closure-table']
        ]));


        $paths[] = $path = $this->getPath($qualifiedClosureInterfaceName, $options['models-path']);
        $stub = $this->getStub('closuretableinterface', 'models');

        $this->filesystem->put($path, $this->parseStub($stub, [
            'namespace' => $nsplaceholder,
            'closure_class' => $options['closure']
        ]));

        return $paths;
    }
357089
public function eachFillable(Closure $closure)
    {
        /** @var FillableField $item */
        foreach ($this->items as $item) {
            if ($item->fillable) {
                $closure($item);
            }
        }
    }
141072
public function group($prefix, \Closure $callback)
    {
        $this->group = $prefix;

        call_user_func($callback, $this);

        $this->group = null;

        return $this;
    }
1362228
public function either(Closure $callback) {
        $predicate = new Predicate(self::EITHER);
        $predicate->bindCallback($callback);

        $this->_params[] = $predicate;

        $this->addBinding(null, $predicate);

        return $this;
    }
692329
public function group(array $options, Closure $routes): void
	{
		$this->groups[] = $options;

		$routes($this);

		array_pop($this->groups);
	}
1108425
public static function dispatch(
        $options = [],
        $closure = null,
        $class = null
    ) {
        if (is_callable($options)) {
            $_closure = $options;
            $_options = $closure;
        } else {
            $_closure = $closure;
            $_options = $options;
        }

        is_array($_options) || $_options = [];

        /** @var Implementation $app */
        self::getInstance($class, $_options);

        is_null($_closure) || $_closure();

        self::getInstance()->dispatch();
    }
731117
public function create($table, Closure $closure)
    {
        $blueprint = $this->createBlueprint($table, $closure);
        $blueprint->create();
    }
476384
public function when($field, $operator, $expected, \Closure $closure)
    {
        $field = $field instanceof Field ? $field : $this->field($field);

        $name = __METHOD__ . $field->name() . $operator . md5(json_encode($expected));

        $this->group($name, $closure);
        $this->getGroup($name)->condition($field, $operator, $expected);

        return $this;
    }
195740
public function map($closure)
    {
        $data = [];
        foreach ($this as $val) {
            $data[] = $closure($val);
        }
        return new Collection(compact('data'));
    }
233588
public function parallel($closure, $options = array(), $start = true)
    {
        // Check auto_start
        if (is_bool($options)) {
            $start = $options;
            $options = array();
        }

        // Check if process set
        if ($closure instanceof Process) {
            $child = $closure;
            $closure = $child->runner;
            $options = $child->options;
        } else {
            // Build new child
            $child = new Process($this, null, $this->pid);

            // Get options
            $options = $this->getOptions($options);
        }

        // Auto start
        if (!$start) {
            $child->register($closure, $options);
            if (!in_array($child, $this->prepared_children)) {
                $this->prepared_children[] = $child;
            }
            return $child;
        }

        // Process init
        if ($options['init'] instanceof \Closure) {
            $options['init']($child);
        }

        // Fork
        $pid = pcntl_fork();

        // Save child process and return
        $this->children[$pid] = $child;
        // Remove from prepared children
        if (($index = array_search($child, $this->prepared_children)) !== false) {
            unset($this->prepared_children[$index]);
        }

        // Parallel works
        if ($pid === -1) {
            throw new \RuntimeException('Unable to fork child process.');
        } else if ($pid) {
            // Save child process and return
            $child->init($pid);
            $child->emit('fork');
            return $child;
        } else {
            // Child initialize
            $this->childInitialize($options);

            // Support callable
            call_user_func($closure, $this->process);
            exit;
        }
    }
1131745
public function group(Closure $closure): self
    {
        $expression = new Expression();
        $closure($expression);
        return $this->addExpression('group', $expression);
    }
475165
public function createScope($closure) {
		$newScope = (new static($this->request, $this->result, $this->urlGenerator));
		$newScope->setupParent(
			$this->prefix,
			$this->prefixMatched,
			$this->requestPathOffset,
			$this->params
		);
		$newScope->use($this->middlewares); // Must add middlewares before adding namespace, as the middlewares are already prefixed with namespace.
		$newScope->namespace($this->namespace);
		$closure($newScope);
	}
61598
protected function adminGroup(Closure $callback)
    {
        $attributes = $this->getAdminAttributes();

        $this->prefix(Arr::get($attributes, 'prefix', 'dashboard'))
             ->name(Arr::get($attributes, 'name', 'admin::'))
             ->namespace($this->adminNamespace)
             ->middleware(Arr::get($attributes, 'middleware', ['web', 'auth', 'admin']))
             ->group($callback);
    }
123583
public function wrap($fieldset, $group, \Closure $handler)
    {
        $bakFieldset = $this->wrap['fieldset'];
        $bakGroup = $this->wrap['group'];

        if ($fieldset !== null) {
            $this->wrap['fieldset'] = $fieldset;
        }

        if ($group !== null) {
            $this->wrap['group'] = $group;
        }

        $handler($this);

        if ($fieldset !== null) {
            $this->wrap['fieldset'] = $bakFieldset;
        }

        if ($group !== null) {
            $this->wrap['group'] = $bakGroup;
        }

        return $this;
    }
958051
public function aggregate(\Closure $closure)
    {
        $builder = new AggregationBuilder($this->query);

        $closure($builder);

        return $this;
    }
392590
public function extend($abstract, Closure $closure)
    {
        $abstract = $this->getAlias($abstract);

        if (isset($this->instances[$abstract])) {
            $this->instances[$abstract] = $closure($this->instances[$abstract], $this);

            $this->rebound($abstract);
        } else {
            $this->extenders[$abstract][] = $closure;

            if ($this->resolved($abstract)) {
                $this->rebound($abstract);
            }
        }
    }