Select random.
@param  string|array|Builder $field
@return self
495038
public function selectRandom($field): self
    {
        return $this->push('select', $this->prepareField($field))
            ->push('where', [[$this->sql('random() < 0.01'), '']]);
    }
1179115
public function pushField(Field $field)
    {
        $field->setForm($this);

        $this->builder->fields()->push($field);

        return $this;
    }
935850
public function resolveForSelection($field)
    {
        if (! is_null($element = $this->findById($field))) {
            return $element;
        }

        return $this->firstOrFail([
            $field, "select[name='{$field}']",
        ]);
    }
795489
public function randomize() : self
    {
        $order = range(0, $this->numRows() - 1);

        shuffle($order);

        array_multisort($order, $this->samples, $this->labels);

        return $this;
    }
364502
public function readonly($field)
    {
        if (is_string($field)) {
            $field = explode(',', $field);
        }

        $this->readonly = $field;

        return $this;
    }
954177
public function select($fields = [])
    {
        if (is_array($fields)) {
            foreach ($fields as $field) {
                $this->addSelect($field);
            }
        } elseif (is_string($fields)) {
            $this->addSelect($fields);
        }

        return $this;
    }
795370
public function from($field, string $as): self
    {
        if (is_string($field) && strpos($field, '(') === false) {
            $field = $this->prepareField($field);
        }

        $this->query['from'] = sprintf('(%s) AS %s', $field, $this->agent->quoteField($as));

        return $this;
    }
111292
public function build_field($field)
	{
		! $field instanceof Fieldset_Field && $field = $this->field($field);

		return $field->build();
	}
922834
public function setSelect(array $fields)
    {
        $this->storageSelect = [];

        foreach ($fields as $key => $field)
        {
            $this->select([$key => $field]);
        }

        return $this;
    }
969729
public function where($field, $value)
    {
        if (!isset($this->_expression[$field]) || !is_array($value) || !is_array($this->_expression[$field])) {
            $this->_expression[$field] = $value;
        } else {
            $this->_expression[$field] = array_merge_recursive($this->_expression[$field], $value);
        }

        return $this;
    }
233225
public function fields($fields = [])
    {
        $this->builder->select([]);
        $this->casts = [];

        if (empty($fields)) {
            foreach ($this->model->fields() as $field) {
                $this->assignField($field);
            }

            return $this;
        }

        foreach ($fields as $field) {
            $this->assignField($this->model->field($field));
        }

        return $this;
    }
833965
protected function select(array $field)
    {
        $output = '';

        // Tag around select element: same as for an input element.
        $output .= $this->getWrapper('input');

        // Select tag.
        $attributes = $field['attributes'];
        $attributes = $this->addAttribute($attributes, 'id', $field['id']);
        $attributes = $this->addAttribute($attributes, 'name', $field['name']);
        $output .= $this->getOpenTag('select', $attributes);

        // Options.
        foreach ($field['options'] as $value => $text) {
            $optionAttributes = array('value' => $value);
            if ($this->isOptionSelected($field['value'], $value)) {
                $optionAttributes['selected'] = true;
            }
            $output .= $this->getOpenTag('option', $optionAttributes);
            $output .= htmlspecialchars($text, $this->htmlSpecialCharsFlag, 'UTF-8');
            $output .= $this->getCloseTag('option');
        }

        // End tag.
        $output .= $this->getCloseTag('select');
        // Tag around select element.
        $output .= $this->getWrapperEnd('input');

        return $output;
    }
26574
public function select($fields)
    {
        $this->select = array_merge(
            $this->select,
            Arr::wrap($fields)
        );

        return $this;
    }
340108
public function select($fields=null)
    {
        if (func_num_args() > 1) {
            $fields = func_get_args();
        }
        $this->getQuery()->type('select')->fields($fields);
        return $this;
    }
157654
private function buildWildcard($field)
    {
        return $this::$open.$field.Operator::$equals.Operator::$wildcard.$this::$close;
    }
189727
public static function createFromField(Field $field): self
    {
        $message = new self();
        $message->setId($field->getId());
        $message->setToken($field->getToken());
        $message->setDescription($field->getDescription());

        foreach ($field->getTranslations() as $translation) {
            $transMessage = FieldTranslationMessage::createFromFieldTranslation($translation);

            $message->addTranslation($transMessage);
        }

        return $message;
    }
353171
public function random($num = 1)
    {
        $count = \count($this->items);
        if ($num > $count) {
            $num = $count;
        }

        $this->items = array_intersect_key($this->items, array_flip((array)array_rand($this->items, $num)));

        return $this;
    }