Build a Nested form.

@param string   $column
@param \Closure $builder
@param null     $key

@return NestedForm
513345
protected function buildNestedForm($column, \Closure $builder, $key = null)
    {
        $form = new Form\NestedForm($column, $key);

        $form->setForm($this->form);

        call_user_func($builder, $form);

        $form->hidden($this->getKeyName());

        $form->hidden(NestedForm::REMOVE_FLAG_NAME)->default(0)->addElementClass(NestedForm::REMOVE_FLAG_CLASS);

        return $form;
    }
934332
public function column(string $column = null): self
    {
        if (! is_null($column)) {
            $this->column = $column;
        }

        if ($this->locale && ! is_null($column)) {
            $locale = '.'.app()->getLocale().'.';
            $this->column = preg_replace('/'.preg_quote('.', '/').'/', $locale, $column);
        }

        return $this;
    }
1076782
protected function createColumn($key, array $columnConfiguration)
    {
        if ($this->translator) {
            $columnConfiguration['translator'] = $this->translator;
        }
        $this->columns[] = new Column($key, $this, $columnConfiguration);
    }
955671
public function lists($column, $key = null)
    {
        $this->applyCriteria();

        return $this->model->lists($column, $key);
    }
773384
public function nestedWhere(
        string $column,
        \Closure $nested,
        string $lOpr = "IN"
    ): self {
        $this->qBuilder->nestedWhere($column, $nested, $lOpr, "AND");
        return $this;
    }
182967
public function scopeHasAttribute(Builder $builder, string $key, $value): Builder
    {
        return $builder->whereHas($key, function (Builder $builder) use ($value) {
            $builder->where('content', $value)->where('entity_type', $this->getMorphClass());
        });
    }
244970
public function plunk($column, $key = null, $limit = null, $useMaster = false)
    {
        $this->sql['columns'] == '' && $this->columns(is_null($key) ? $column : [$key, $column]);
        $result = $this->select(0, $limit, $useMaster);
        $return = [];
        foreach ($result as $row) {
            is_null($key) ? $return[] = $row[$column] : $return[$row[$key]] = $row[$column];
        }
        return $return;
    }
45254
protected function getMetaColumnValueByKey(array $column, $key)
    {
        if (array_key_exists('Field', $column)) {
            $keyMap = [
                'Field'        => 'Field',
                'Type'         => 'Type',
                'Null'         => 'Null',
                'Key'          => 'Key',
                'Default'      => 'Default',
                'Extra'        => 'Extra',
                'Comment'      => 'Comment',
                'CharacterSet' => 'CharacterSet',
                'Collation'    => 'Collation',
            ];
        } else {
            $keyMap = [
                'Field'        => 0,
                'Type'         => 1,
                'Null'         => 2,
                'Key'          => 3,
                'Default'      => 4,
                'Extra'        => 5,
                'Comment'      => 6,
                'CharacterSet' => 7,
                'Collation'    => 8,
            ];
        }

        $result = $column[$keyMap[$key]];

        return $result;
    }
284555
public function orHaving($column, Closure $value = null): self
    {
        $this->have->orHaving($column, $value);
        return $this;
    }
549159
protected function resolve($column, $key, $last, callable $callback)
    {
        if (! strpos($column, '.')) {
            return $callback("{$last}.{$column}", $key);
        }

        $scope = strstr($column, '.', true);
        $singular = str_singular($scope);
        $next = substr(strstr($column, '.'), 1);

        if (! in_array($scope, $this->loaded)) {
            $this->loaded[] = $scope;

            $this->builder->join($scope, "{$last}.{$singular}_id", "{$scope}.id");
        }

        return $this->resolve($next, $key, $scope, $callback);
    }
1164820
public function allCallback(Closure $callback, $columns = ['*'])
    {
        /** @var EloquentBuilder $result */
        $result = $callback( $this->query() );

        $this->checkValidCustomCallback($result);

        return $result->get($columns);
    }
711148
public function column($width, \Closure $closure)
    {
        if ($this->columns->isEmpty()) {
            $column = $this->current;

            $column->setWidth($width);
        } else {
            $column = new Column($width);

            $this->current = $column;
        }

        $this->columns->push($column);

        $closure($this->parent);
    }
554514
protected function resolveOrder($column, $key)
    {
        $this->resolve($column, $key, $this->getTableName(), function ($query, $pattern) {
            $this->builder->orderBy($query, $pattern);
        });
    }
153876
public function andHaving($column, Closure $value = null)
    {
        return $this->buildSelect()->andHaving($column, $value);
    }
393450
private function appendColumnNode(Column $column, \DOMNode $parentNode)
    {
        $columnNode = $parentNode->appendChild($this->document->createElement('column'));
        $columnNode->setAttribute('name', $column->getName());

        if ($phpName = $column->getPhpName()) {
            $columnNode->setAttribute('phpName', $phpName);
        }

        $columnNode->setAttribute('type', $column->getType());

        $domain = $column->getDomain();
        if ($size = $domain->getSize()) {
            $columnNode->setAttribute('size', $size);
        }

        if (null !== ($scale = $domain->getScale())) {
            $columnNode->setAttribute('scale', $scale);
        }

        $platform = $column->getPlatform();
        if ($platform && !$column->isDefaultSqlType($platform)) {
            $columnNode->setAttribute('sqlType', $domain->getSqlType());
        }

        if ($description = $column->getDescription()) {
            $columnNode->setAttribute('description', $description);
        }

        if ($column->isPrimaryKey()) {
            $columnNode->setAttribute('primaryKey', 'true');
        }

        if ($column->isAutoIncrement()) {
            $columnNode->setAttribute('autoIncrement', 'true');
        }

        if ($column->isNotNull()) {
            $columnNode->setAttribute('required', 'true');
        }

        $defaultValue = $domain->getDefaultValue();
        if ($defaultValue) {
            $type = $defaultValue->isExpression() ? 'defaultExpr' : 'defaultValue';
            $columnNode->setAttribute($type, $defaultValue->getValue());
        }

        if ($column->isInheritance()) {
            $columnNode->setAttribute('inheritance', $column->getInheritanceType());
            foreach ($column->getInheritanceList() as $inheritance) {
                $this->appendInheritanceNode($inheritance, $columnNode);
            }
        }

        if ($column->isNodeKey()) {
            $columnNode->setAttribute('nodeKey', 'true');
            if ($nodeKeySeparator = $column->getNodeKeySep()) {
                $columnNode->setAttribute('nodeKeySep', $nodeKeySeparator);
            }
        }

        foreach ($column->getVendorInformation() as $vendorInformation) {
            $this->appendVendorInformationNode($vendorInformation, $columnNode);
        }
    }
261116
public function allCallback(Closure $callback, $columns = ['*'])
    {
        return $this->postProcess( parent::allCallback($callback, $columns) );
    }
215649
protected function bindOriginalRow(Closure $callback, $key)
    {
        $originalRow = static::$originalGridData[$key];

        return $callback->bindTo(static::$model->newFromBuilder($originalRow));
    }