hidden
Hidden input, optionally with a visible label.
Signature
Section titled “Signature”Lte3::hidden(string $name, mixed $value = null, array $attrs = [])Blade: lte3::components.hidden. The value is resolved as described in Value resolution, so inside a form with a model Lte3::hidden('id') takes $model->id.
Basic example
Section titled “Basic example”{!! Lte3::hidden('parent_id', $parent->id) !!}
{!! Lte3::hidden('__tmp', '666', ['label' => 'Hidden field']) !!}| Attr | Type | Default | Description |
|---|---|---|---|
label | string | - | When set, a .form-group with this label is printed before the input. No label by default. |
help | string | - | Help HTML after the input. |
class | string | - | Classes of the input. |
class_wrap | string | - | Wraps the field in a <div> with these classes. No wrapper by default. |
disabled | bool | false | Adds disabled; the field is not submitted. |
attrs | array | - | Arbitrary HTML attributes of the input. |
default | mixed | - | Fallback value. |
formatter | callable or class | - | Transforms the value before rendering. |
Keys from lte3.view.field_attrs (id, data-name, x-model, …) are printed on the input.
Service fields
Section titled “Service fields”The package reads several hidden fields on submit, for example:
{{-- open this modal after the form is submitted and the page reloads --}}{!! Lte3::hidden('_modal', '#my-modal-lg') !!}The key names come from the config: lte3.view.modal_key (_modal) and lte3.view.next_destination_key (_destination), see Request options.
For a field named _method, old() and request values are ignored and the passed value (or the model value) is always used.
Editor storage
Section titled “Editor storage”A hidden input with an id often holds data of a JS editor, e.g. Editor.js JSON:
{!! Lte3::hidden('editorjs_data', $json, ['id' => 'editorjs_data']) !!}See Editors.
Submitted data
Section titled “Submitted data”name — the value (nothing when disabled).
Related
Section titled “Related”- Fields overview.
- Config:
lte3.view.components.hidden.