MultipleFile
class MultipleFile extends Field
Traits
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
Create a new File instance.
Set the validation rules for the field.
Set the update validation rules for the field.
Set the creation validation rules for the field.
Set validation messages for column.
Set help block for current field.
No description
No description
Add html attributes to elements.
Prepare for saving.
reset field className.
Render file upload field.
Add required
attribute to current field if has required rule,
except file and image fields.
If has required
rule, add required attribute to this field.
Indicates if the underlying field is downloadable.
Indicates if the underlying field is retainable.
Specify the directory and name for upload file.
Destroy original files.
Set file permission when stored into storage.
Generate a unique name for uploaded file.
Generate a sequence name for uploaded file.
Default directory for file to upload.
Hydrate the files array.
Sort files.
Prepare for each file.
Preview html for file-upload plugin.
Initialize the caption.
No description
Allow to sort files.
Details
at line 21
__construct($column, array $arguments = [])
Create a new File instance.
in
Field at line 240
$this
setElementName(string $name)
Set form element name.
in
Field at line 254
void
fill(array $data)
Fill data to the field.
in
Field at line 292
void
setOriginal(array $data)
Set original value to the field.
in
Field at line 325
$this
setWidth(int $field = 8, int $label = 2)
Set width for field and label.
in
UploadField at line 139
$this
options(array $options = [])
Set options for file-upload plugin.
in
Field at line 360
$this
checked(array $checked = [])
Set the field option checked.
in
Field at line 379
$this
rules(array $rules = [], array $messages = [])
Set the validation rules for the field.
in
Field at line 396
$this
updateRules(array|callable $rules = [], array $messages = [])
Set the update validation rules for the field.
in
Field at line 413
$this
creationRules(array|callable $rules = [], array $messages = [])
Set the creation validation rules for the field.
in
Field at line 427
array|mixed
getValidationMessages()
Get validation messages for the field.
in
Field at line 450
$this
setValidationMessages(string $key, array $messages)
Set validation messages for column.
in
Field at line 464
$this
validator(callable $validator)
Set field validator.
in
Field at line 476
string
getErrorKey()
Get key for error message.
in
Field at line 488
$this
setErrorKey(string $key)
Set key for error message.
in
Field at line 502
mixed
value(null $value = null)
Set or get value of the field.
in
Field at line 518
$this
data(array $data = null)
Set or get data.
in
Field at line 536
$this
default($default)
Set default value for field.
in
Field at line 548
mixed
getDefault()
Get default value.
in
Field at line 565
$this
help(string $text = '', string $icon = 'fa-info-circle')
Set help block for current field.
in
Field at line 577
string|array
column()
Get column of the field.
in
Field at line 587
string
label()
Get label of the field.
at line 137
mixed
original()
No description
at line 41
bool|Validator|mixed
getValidator(array $input)
No description
in
Field at line 650
$this
attribute(array|string $attribute, mixed $value = null)
Add html attributes to elements.
in
Field at line 670
$this
style(string $attr, string $value)
Set Field style.
in
Field at line 682
$this
width(string $width)
Set Field width.
in
Field at line 692
$this
autofocus()
Set the field automatically get focus.
in
Field at line 702
$this
readonly()
Set the field as readonly mode.
in
Field at line 712
$this
disable()
Set field as disabled.
in
Field at line 724
$this
placeholder(string $placeholder = '')
Set field placeholder.
in
Field at line 736
string
getPlaceholder()
Get placeholder.
at line 119
mixed
prepare(UploadedFile|array $files)
Prepare for saving.
in
Field at line 758
$this
disableHorizontal()
No description
in
Field at line 768
array
getViewElementClasses()
No description
in
Field at line 790
array
getElementClass()
Get element class.
in
Field at line 802
$this
setElementClass(string|array $class)
Set form element class.
in
Field at line 816
$this
addElementClass($class)
Add the element class.
in
Field at line 832
$this
removeElementClass($class)
Remove element class.
in
Field at line 857
$this
resetElementClassName(string $className, string $resetClassName)
reset field className.
in
Field at line 869
string
getLabelClass()
No description
in
Field at line 891
array
variables()
Get the view variables of this field.
in
Field at line 916
string
getView()
Get view of this field.
in
Field at line 934
string
setView(string $view)
Set view of current field.
in
Field at line 941
string
getType()
No description
in
Field at line 954
$this
setDisplay(bool $display)
To set this field should render or not.
at line 230
Factory|View|string
render()
Render file upload field.
in
Field at line 995
string
__toString()
No description
in
Field at line 1005
string
getRules()
Get field validation rules.
in
Field at line 1051
array|mixed|string
formatName(string $column)
Format the name of the field.
in
Field at line 1085
array
skeleton()
No description
in
Field at line 1097
protected mixed
formatColumn(string $column = '')
Format the field column name.
in
Field at line 1115
protected string|array
formatId(string|array $column)
Format the field element id.
in
Field at line 1127
protected string
formatLabel(array $arguments = [])
Format the label value.
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.
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.
in
Field at line 1198
protected array|Closure
mergeRules(string|array|Closure $input, string|array $original)
No description
in
Field at line 1221
protected void
removeRule(string $rule)
Remove a specific rule by keyword.
in
Field at line 1244
protected array
sanitizeInput(array $input, string $column)
Sanitize input data.
in
Field at line 1259
protected string
formatAttributes()
Format the field attributes.
in
Field at line 1275
protected mixed
getElementClassString()
Get element class string.
in
Field at line 1298
protected string|array
getElementClassSelector()
Get element class selector.
in
Field at line 1322
protected string
getGroupClass(bool $default = false)
Get element class.
in
Field at line 1353
protected Field
addVariables(array $variables = [])
Add variables to field view.
in
Field at line 1368
protected bool
shouldRender()
If this field should render.
in
UploadField at line 101
$this
downloadable(bool $downloadable = true)
Indicates if the underlying field is downloadable.
in
UploadField at line 113
$this
removable()
Allow use to remove file.
in
UploadField at line 125
$this
retainable($retainable = true)
Indicates if the underlying field is retainable.
in
UploadField at line 155
$this
disk(string $disk)
Set disk for storage.
in
UploadField at line 178
$this
move(string $directory, null|string $name = null)
Specify the directory and name for upload file.
in
UploadField at line 194
$this
dir(string $dir)
Specify the directory upload file.
in
UploadField at line 210
$this
name(string|callable $name)
Set name of store name.
in
UploadField at line 224
$this
uniqueName()
Use unique name for store upload file.
in
UploadField at line 236
$this
sequenceName()
Use sequence name for store upload file.
in
UploadField at line 248
mixed|string
getDirectory()
Get directory for store file.
in
UploadField at line 264
void
renameIfExists(UploadedFile $file)
If name already exists, rename it.
in
UploadField at line 278
string
objectUrl($path)
Get file visit url.
at line 251
destroy(string $key)
Destroy original files.
in
UploadField at line 318
$this
storagePermission(string $permission)
Set file permission when stored into storage.
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.
in
UploadField at line 373
protected void
setupPreviewOptions()
Set preview options form image field.
in
UploadField at line 383
protected array|bool
guessPreviewType($file)
No description
in
UploadField at line 419
protected string
getStoreName(UploadedFile $file)
Get store name of upload file.
in
UploadField at line 447
protected mixed
upload(UploadedFile $file)
Upload file and delete original file.
in
UploadField at line 465
protected string
generateUniqueName(UploadedFile $file)
Generate a unique name for uploaded file.
in
UploadField at line 477
protected string
generateSequenceName(UploadedFile $file)
Generate a sequence name for uploaded file.
at line 33
mixed
defaultDirectory()
Default directory for file to upload.
at line 75
protected array
hydrateFiles(array $value)
Hydrate the files array.
at line 98
protected array
sortFiles(string $order)
Sort files.
at line 153
protected mixed|string
prepareForeach(UploadedFile $file = null)
Prepare for each file.
at line 167
protected array
preview()
Preview html for file-upload plugin.
at line 181
protected string
initialCaption(array $caption)
Initialize the caption.
at line 195
protected array
initialPreviewConfig()
No description
at line 218
$this
sortable()
Allow to sort files.