class Display extends Field

Traits

Macroable

Constants

FILE_DELETE_FLAG

FILE_SORT_FLAG

Properties

array|Closure $creationRules

The validation rules for creation.

from  Field
array|Closure $updateRules

The validation rules for updates.

from  Field
bool $isJsonType from  Field
protected array|string $id

Element id.

from  Field
protected mixed $value

Element value.

from  Field
protected mixed $data

Data of all original columns of value.

from  Field
protected mixed $original

Field original value.

from  Field
protected mixed $default

Field default value.

from  Field
protected string $label

Element label.

from  Field
protected string|array $column

Column name.

from  Field
protected string $elementName

Form element name.

from  Field
protected array $elementClass

Form element classes.

from  Field
protected array $variables

Variables of elements.

from  Field
protected array $options

Options for specify elements.

from  Field
protected array $checked

Checked for specify elements.

from  Field
protected array|Closure $rules

Validation rules.

from  Field
protected Closure $validator from  Field
protected array $validationMessages

Validation messages.

from  Field
protected array $attributes

Element attributes.

from  Field
protected Form $form

Parent form.

from  Field
protected string $view

View for field to render.

from  Field
protected array $help

Help block.

from  Field
protected mixed $errorKey

Key for errors.

from  Field
protected string|array $placeholder

Placeholder for this field.

from  Field
protected bool $showHelp from  Field
protected array $width

Width for label and field.

from  Field
protected bool $horizontal

If the form horizontal layout.

from  Field
protected Closure $customFormat

column data format.

from  Field
protected bool $display from  Field
protected array $labelClass from  Field
protected array $groupClass from  Field
protected Closure $callback from  Field

Methods

__construct($column = '', array $arguments = [])

Field constructor.

from  Field
$this
setElementName(string $name)

Set form element name.

from  Field
void
fill(array $data)

Fill data to the field.

from  Field
$this
customFormat(Closure $call)

custom format form column data when edit.

from  Field
void
setOriginal(array $data)

Set original value to the field.

from  Field
$this
setForm(Form $form = null)

No description

from  Field
$this
setWidth(int $field = 8, int $label = 2)

Set width for field and label.

from  Field
$this
options(array $options = [])

Set the field options.

from  Field
$this
checked(array $checked = [])

Set the field option checked.

from  Field
$this
rules(array $rules = [], array $messages = [])

Set the validation rules for the field.

from  Field
$this
updateRules(array|callable $rules = [], array $messages = [])

Set the update validation rules for the field.

from  Field
$this
creationRules(array|callable $rules = [], array $messages = [])

Set the creation validation rules for the field.

from  Field
array|mixed
getValidationMessages()

Get validation messages for the field.

from  Field
$this
setValidationMessages(string $key, array $messages)

Set validation messages for column.

from  Field
$this
validator(callable $validator)

Set field validator.

from  Field
string
getErrorKey()

Get key for error message.

from  Field
$this
setErrorKey(string $key)

Set key for error message.

from  Field
mixed
value(null $value = null)

Set or get value of the field.

from  Field
$this
data(array $data = null)

Set or get data.

from  Field
$this
default($default)

Set default value for field.

from  Field
mixed
getDefault()

Get default value.

from  Field
$this
help(string $text = '', string $icon = 'fa-info-circle')

Set help block for current field.

from  Field
string|array
column()

Get column of the field.

from  Field
string
label()

Get label of the field.

from  Field
mixed
original()

Get original value of the field.

from  Field
bool|Validator|mixed
getValidator(array $input)

Get validator for this field.

from  Field
$this
attribute(array|string $attribute, mixed $value = null)

Add html attributes to elements.

from  Field
$this
style(string $attr, string $value)

Set Field style.

from  Field
$this
width(string $width)

Set Field width.

from  Field
$this
autofocus()

Set the field automatically get focus.

from  Field
$this
readonly()

Set the field as readonly mode.

from  Field
$this
disable()

Set field as disabled.

from  Field
$this
placeholder(string $placeholder = '')

Set field placeholder.

from  Field
string
getPlaceholder()

Get placeholder.

from  Field
mixed
prepare($value)

Prepare for a field value before update or insert.

from  Field
$this
disableHorizontal()

No description

from  Field
array
getViewElementClasses()

No description

from  Field
array
getElementClass()

Get element class.

from  Field
$this
setElementClass(string|array $class)

Set form element class.

from  Field
$this
addElementClass($class)

Add the element class.

from  Field
$this
removeElementClass($class)

Remove element class.

from  Field
$this
resetElementClassName(string $className, string $resetClassName)

reset field className.

from  Field
string
getLabelClass()

No description

from  Field
setLabelClass(array $labelClass)

No description

from  Field
array
variables()

Get the view variables of this field.

from  Field
string
getView()

Get view of this field.

from  Field
string
setView(string $view)

Set view of current field.

from  Field
string
getType()

No description

from  Field
$this
setDisplay(bool $display)

To set this field should render or not.

from  Field
with(Closure $callback)

No description

from  Field
Factory|View|string
render()

Render this filed.

from  Field
string
__toString()

No description

from  Field
string
getRules()

Get field validation rules.

from  Field
array|mixed|string
formatName(string $column)

Format the name of the field.

from  Field
array
skeleton()

No description

from  Field
mixed
formatColumn(string $column = '')

Format the field column name.

from  Field
string|array
formatId(string|array $column)

Format the field element id.

from  Field
string
formatLabel(array $arguments = [])

Format the label value.

from  Field
formatValue()

Format value by passing custom formater.

from  Field
addRequiredAttribute(array $rules)

Add required attribute to current field if has required rule, except file and image fields.

from  Field
addRequiredAttributeFromRules()

If has required rule, add required attribute to this field.

from  Field
array
formatRules(array|string $rules)

Format validation rules.

from  Field
array|Closure
mergeRules(string|array|Closure $input, string|array $original)

No description

from  Field
void
removeRule(string $rule)

Remove a specific rule by keyword.

from  Field
array
sanitizeInput(array $input, string $column)

Sanitize input data.

from  Field
string
formatAttributes()

Format the field attributes.

from  Field
mixed
getElementClassString()

Get element class string.

from  Field
string|array
getElementClassSelector()

Get element class selector.

from  Field
string
getGroupClass(bool $default = false)

Get element class.

from  Field
setGroupClass(string|array $class)

Set form group class.

from  Field
addVariables(array $variables = [])

Add variables to field view.

from  Field
bool
shouldRender()

If this field should render.

from  Field

Details

in Field at line 224
__construct($column = '', array $arguments = [])

Field constructor.

Parameters

$column
array $arguments

in Field at line 240
$this setElementName(string $name)

Set form element name.

Parameters

string $name

Return Value

$this

in Field at line 254
void fill(array $data)

Fill data to the field.

Parameters

array $data

Return Value

void

in Field at line 278
$this customFormat(Closure $call)

custom format form column data when edit.

Parameters

Closure $call

Return Value

$this

in Field at line 292
void setOriginal(array $data)

Set original value to the field.

Parameters

array $data

Return Value

void

in Field at line 310
$this setForm(Form $form = null)

No description

Parameters

Form $form

Return Value

$this

in Field at line 325
$this setWidth(int $field = 8, int $label = 2)

Set width for field and label.

Parameters

int $field
int $label

Return Value

$this

in Field at line 342
$this options(array $options = [])

Set the field options.

Parameters

array $options

Return Value

$this

in Field at line 360
$this checked(array $checked = [])

Set the field option checked.

Parameters

array $checked

Return Value

$this

in Field at line 379
$this rules(array $rules = [], array $messages = [])

Set the validation rules for the field.

Parameters

array $rules
array $messages

Return Value

$this

in Field at line 396
$this updateRules(array|callable $rules = [], array $messages = [])

Set the update validation rules for the field.

Parameters

array|callable $rules
array $messages

Return Value

$this

in Field at line 413
$this creationRules(array|callable $rules = [], array $messages = [])

Set the creation validation rules for the field.

Parameters

array|callable $rules
array $messages

Return Value

$this

in Field at line 427
array|mixed getValidationMessages()

Get validation messages for the field.

Return Value

array|mixed

in Field at line 450
$this setValidationMessages(string $key, array $messages)

Set validation messages for column.

Parameters

string $key
array $messages

Return Value

$this

in Field at line 464
$this validator(callable $validator)

Set field validator.

Parameters

callable $validator

Return Value

$this

in Field at line 476
string getErrorKey()

Get key for error message.

Return Value

string

in Field at line 488
$this setErrorKey(string $key)

Set key for error message.

Parameters

string $key

Return Value

$this

in Field at line 502
mixed value(null $value = null)

Set or get value of the field.

Parameters

null $value

Return Value

mixed

in Field at line 518
$this data(array $data = null)

Set or get data.

Parameters

array $data

Return Value

$this

in Field at line 536
$this default($default)

Set default value for field.

Parameters

$default

Return Value

$this

in Field at line 548
mixed getDefault()

Get default value.

Return Value

mixed

in Field at line 565
$this help(string $text = '', string $icon = 'fa-info-circle')

Set help block for current field.

Parameters

string $text
string $icon

Return Value

$this

in Field at line 577
string|array column()

Get column of the field.

Return Value

string|array

in Field at line 587
string label()

Get label of the field.

Return Value

string

in Field at line 597
mixed original()

Get original value of the field.

Return Value

mixed

in Field at line 609
bool|Validator|mixed getValidator(array $input)

Get validator for this field.

Parameters

array $input

Return Value

bool|Validator|mixed

in Field at line 650
$this attribute(array|string $attribute, mixed $value = null)

Add html attributes to elements.

Parameters

array|string $attribute
mixed $value

Return Value

$this

in Field at line 670
$this style(string $attr, string $value)

Set Field style.

Parameters

string $attr
string $value

Return Value

$this

in Field at line 682
$this width(string $width)

Set Field width.

Parameters

string $width

Return Value

$this

in Field at line 692
$this autofocus()

Set the field automatically get focus.

Return Value

$this

in Field at line 702
$this readonly()

Set the field as readonly mode.

Return Value

$this

in Field at line 712
$this disable()

Set field as disabled.

Return Value

$this

in Field at line 724
$this placeholder(string $placeholder = '')

Set field placeholder.

Parameters

string $placeholder

Return Value

$this

in Field at line 736
string getPlaceholder()

Get placeholder.

Return Value

string

in Field at line 750
mixed prepare($value)

Prepare for a field value before update or insert.

Parameters

$value

Return Value

mixed

in Field at line 758
$this disableHorizontal()

No description

Return Value

$this

in Field at line 768
array getViewElementClasses()

No description

Return Value

array

in Field at line 790
array getElementClass()

Get element class.

Return Value

array

in Field at line 802
$this setElementClass(string|array $class)

Set form element class.

Parameters

string|array $class

Return Value

$this

in Field at line 816
$this addElementClass($class)

Add the element class.

Parameters

$class

Return Value

$this

in Field at line 832
$this removeElementClass($class)

Remove element class.

Parameters

$class

Return Value

$this

in Field at line 857
$this resetElementClassName(string $className, string $resetClassName)

reset field className.

Parameters

string $className
string $resetClassName

Return Value

$this

in Field at line 869
string getLabelClass()

No description

Return Value

string

in Field at line 879
Field setLabelClass(array $labelClass)

No description

Parameters

array $labelClass

Return Value

Field

in Field at line 891
array variables()

Get the view variables of this field.

Return Value

array

in Field at line 916
string getView()

Get view of this field.

Return Value

string

in Field at line 934
string setView(string $view)

Set view of current field.

Parameters

string $view

Return Value

string

in Field at line 941
string getType()

No description

Return Value

string

in Field at line 954
$this setDisplay(bool $display)

To set this field should render or not.

Parameters

bool $display

Return Value

$this

in Field at line 966
Field with(Closure $callback)

No description

Parameters

Closure $callback

Return Value

Field

in Field at line 978
Factory|View|string render()

Render this filed.

Return Value

Factory|View|string

in Field at line 995
string __toString()

No description

Return Value

string

Exceptions

Throwable

in Field at line 1005
string getRules()

Get field validation rules.

Return Value

string

in Field at line 1051
array|mixed|string formatName(string $column)

Format the name of the field.

Parameters

string $column

Return Value

array|mixed|string

in Field at line 1085
array skeleton()

No description

Return Value

array

in Field at line 1097
protected mixed formatColumn(string $column = '')

Format the field column name.

Parameters

string $column

Return Value

mixed

in Field at line 1115
protected string|array formatId(string|array $column)

Format the field element id.

Parameters

string|array $column

Return Value

string|array

in Field at line 1127
protected string formatLabel(array $arguments = [])

Format the label value.

Parameters

array $arguments

Return Value

string

in Field at line 1139
protected formatValue()

Format value by passing custom formater.

in Field at line 1152
protected addRequiredAttribute(array $rules)

Add required attribute to current field if has required rule, except file and image fields.

Parameters

array $rules

in Field at line 1162
protected addRequiredAttributeFromRules()

If has required rule, add required attribute to this field.

in Field at line 1183
protected array formatRules(array|string $rules)

Format validation rules.

Parameters

array|string $rules

Return Value

array

in Field at line 1198
protected array|Closure mergeRules(string|array|Closure $input, string|array $original)

No description

Parameters

string|array|Closure $input
string|array $original

Return Value

array|Closure

in Field at line 1221
protected void removeRule(string $rule)

Remove a specific rule by keyword.

Parameters

string $rule

Return Value

void

in Field at line 1244
protected array sanitizeInput(array $input, string $column)

Sanitize input data.

Parameters

array $input
string $column

Return Value

array

in Field at line 1259
protected string formatAttributes()

Format the field attributes.

Return Value

string

in Field at line 1275
protected mixed getElementClassString()

Get element class string.

Return Value

mixed

in Field at line 1298
protected string|array getElementClassSelector()

Get element class selector.

Return Value

string|array

in Field at line 1322
protected string getGroupClass(bool $default = false)

Get element class.

Parameters

bool $default

Return Value

string

in Field at line 1334
Field setGroupClass(string|array $class)

Set form group class.

Parameters

string|array $class

Return Value

Field

in Field at line 1353
protected Field addVariables(array $variables = [])

Add variables to field view.

Parameters

array $variables

Return Value

Field

in Field at line 1368
protected bool shouldRender()

If this field should render.

Return Value

bool