Skip to content

input default

Thorazine edited this page Jul 22, 2017 · 1 revision

Every input requires some settings. Some are required to make the system work, others are optional. Example:

'title' => [
    'type' => 'text',
    'label' => trans('hack::modules.pages.title'),
    'regex' => '',
    'overview' => false,
],

Every input

Key Type Default Required
type string null yes
label string null yes
regex string null yes
values string or array null yes
default string '' no
overview boolean true no
create boolean true no
edit boolean true no
save boolean true no

type

This is the name of the blade in the resources/inputs/[action]/[type] folder.

label

This is the label for the page field.

regex

You should use the Laravel validation rules. If used as is, the rules will apply to the create and the update actions. But it is also possible to make an array of it to have different rules for create and update:

'regex' => [
    'create' => '',
    'edit' => '',
]

values

The values field can either require only a string, a string reference to a function or an array. It can never be a nameless function. Depending on the type of input it requires a string or array.

default

The default value for the input

overview

Show this value on the overview table or not

create

Show on create or not

edit

Show on edit or not

save

Show it, but don't save it. This is usually used for helper fields that have no database record.