class MultipleFile 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
protected string $directory

Upload directory.

from  UploadField
protected null $name

File name.

from  UploadField
protected Filesystem $storage

Storage instance.

from  UploadField
protected bool $useUniqueName

If use unique name to store upload file.

from  UploadField
protected bool $useSequenceName

If use sequence name to store upload file.

from  UploadField
protected bool $retainable

Retain file when delete record from DB.

from  UploadField
protected bool $downloadable from  UploadField
protected array $fileActionSettings

Configuration for setting up file actions for newly selected file thumbnails in the preview window.

from  UploadField
protected string $storagePermission

Controls the storage permission. Could be 'private' or 'public'.

from  UploadField
protected array $fileTypes from  UploadField

Methods

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

Create a new File instance.

$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 options for file-upload plugin.

$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()

No description

bool|Validator|mixed
getValidator(array $input)

No description

$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(UploadedFile|array $files)

Prepare for saving.

$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 file upload 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
$this
downloadable(bool $downloadable = true)

Indicates if the underlying field is downloadable.

$this
removable()

Allow use to remove file.

$this
retainable($retainable = true)

Indicates if the underlying field is retainable.

$this
disk(string $disk)

Set disk for storage.

$this
move(string $directory, null|string $name = null)

Specify the directory and name for upload file.

$this
dir(string $dir)

Specify the directory upload file.

$this
name(string|callable $name)

Set name of store name.

$this
uniqueName()

Use unique name for store upload file.

$this
sequenceName()

Use sequence name for store upload file.

mixed|string
getDirectory()

Get directory for store file.

void
renameIfExists(UploadedFile $file)

If name already exists, rename it.

string
objectUrl($path)

Get file visit url.

destroy(string $key)

Destroy original files.

$this
storagePermission(string $permission)

Set file permission when stored into storage.

initStorage()

Initialize the storage instance.

void
setupDefaultOptions()

Set default options form image field.

void
setupPreviewOptions()

Set preview options form image field.

array|bool
guessPreviewType($file)

No description

string
getStoreName(UploadedFile $file)

Get store name of upload file.

mixed
upload(UploadedFile $file)

Upload file and delete original file.

string
generateUniqueName(UploadedFile $file)

Generate a unique name for uploaded file.

string
generateSequenceName(UploadedFile $file)

Generate a sequence name for uploaded file.

mixed
defaultDirectory()

Default directory for file to upload.

array
hydrateFiles(array $value)

Hydrate the files array.

array
sortFiles(string $order)

Sort files.

mixed|string
prepareForeach(UploadedFile $file = null)

Prepare for each file.

array
preview()

Preview html for file-upload plugin.

string
initialCaption(array $caption)

Initialize the caption.

array
initialPreviewConfig()

No description

$this
sortable()

Allow to sort files.

Details

at line 21
__construct($column, array $arguments = [])

Create a new File instance.

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 UploadField at line 139
$this options(array $options = [])

Set options for file-upload plugin.

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

at line 137
mixed original()

No description

Return Value

mixed

at line 41
bool|Validator|mixed getValidator(array $input)

No description

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

at line 119
mixed prepare(UploadedFile|array $files)

Prepare for saving.

Parameters

UploadedFile|array $files

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

at line 230
Factory|View|string render()

Render file upload field.

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

in UploadField at line 101
$this downloadable(bool $downloadable = true)

Indicates if the underlying field is downloadable.

Parameters

bool $downloadable

Return Value

$this

in UploadField at line 113
$this removable()

Allow use to remove file.

Return Value

$this

in UploadField at line 125
$this retainable($retainable = true)

Indicates if the underlying field is retainable.

Parameters

$retainable

Return Value

$this

in UploadField at line 155
$this disk(string $disk)

Set disk for storage.

Parameters

string $disk

Disks defined in config/filesystems.php.

Return Value

$this

Exceptions

Exception

in UploadField at line 178
$this move(string $directory, null|string $name = null)

Specify the directory and name for upload file.

Parameters

string $directory
null|string $name

Return Value

$this

in UploadField at line 194
$this dir(string $dir)

Specify the directory upload file.

Parameters

string $dir

Return Value

$this

in UploadField at line 210
$this name(string|callable $name)

Set name of store name.

Parameters

string|callable $name

Return Value

$this

in UploadField at line 224
$this uniqueName()

Use unique name for store upload file.

Return Value

$this

in UploadField at line 236
$this sequenceName()

Use sequence name for store upload file.

Return Value

$this

in UploadField at line 248
mixed|string getDirectory()

Get directory for store file.

Return Value

mixed|string

in UploadField at line 264
void renameIfExists(UploadedFile $file)

If name already exists, rename it.

Parameters

UploadedFile $file

Return Value

void

in UploadField at line 278
string objectUrl($path)

Get file visit url.

Parameters

$path

Return Value

string

at line 251
destroy(string $key)

Destroy original files.

Parameters

string $key

in UploadField at line 318
$this storagePermission(string $permission)

Set file permission when stored into storage.

Parameters

string $permission

Return Value

$this

in UploadField at line 330
protected initStorage()

Initialize the storage instance.

in UploadField at line 340
protected void setupDefaultOptions()

Set default options form image field.

Return Value

void

in UploadField at line 373
protected void setupPreviewOptions()

Set preview options form image field.

Return Value

void

in UploadField at line 383
protected array|bool guessPreviewType($file)

No description

Parameters

$file

Return Value

array|bool

in UploadField at line 419
protected string getStoreName(UploadedFile $file)

Get store name of upload file.

Parameters

UploadedFile $file

Return Value

string

in UploadField at line 447
protected mixed upload(UploadedFile $file)

Upload file and delete original file.

Parameters

UploadedFile $file

Return Value

mixed

in UploadField at line 465
protected string generateUniqueName(UploadedFile $file)

Generate a unique name for uploaded file.

Parameters

UploadedFile $file

Return Value

string

in UploadField at line 477
protected string generateSequenceName(UploadedFile $file)

Generate a sequence name for uploaded file.

Parameters

UploadedFile $file

Return Value

string

at line 33
mixed defaultDirectory()

Default directory for file to upload.

Return Value

mixed

at line 75
protected array hydrateFiles(array $value)

Hydrate the files array.

Parameters

array $value

Return Value

array

at line 98
protected array sortFiles(string $order)

Sort files.

Parameters

string $order

Return Value

array

at line 153
protected mixed|string prepareForeach(UploadedFile $file = null)

Prepare for each file.

Parameters

UploadedFile $file

Return Value

mixed|string

at line 167
protected array preview()

Preview html for file-upload plugin.

Return Value

array

at line 181
protected string initialCaption(array $caption)

Initialize the caption.

Parameters

array $caption

Return Value

string

at line 195
protected array initialPreviewConfig()

No description

Return Value

array

at line 218
$this sortable()

Allow to sort files.

Return Value

$this