Form
class Form implements Renderable
Class Form.
Traits
Constants
REMOVE_FLAG_NAME |
Remove flag in |
Properties
protected array | $hooks | Supported hooks: submitted, editing, saving, saved, deleting, deleted. |
from HasHooks |
array | $rows | Field rows in form. |
|
static array | $availableFields | Available fields. |
|
static array | $fieldAlias | Form field alias. |
|
protected Model | $model | Eloquent model of the form. |
|
protected Validator | $validator | ||
protected Builder | $builder | ||
protected array | $updates | Data for save to current model from input. |
|
protected array | $relations | Data for save to model's relations from input. |
|
protected array | $inputs | Input data. |
|
protected Layout | $layout | ||
protected array | $ignored | Ignored saving fields. |
|
protected Tab | $tab | ||
protected bool | $isSoftDeletes | ||
static protected array | $collectedAssets | Collected field assets. |
|
static protected | $initCallbacks | Initialization closure array. |
Methods
No description
Generate a edit form.
Destroy data entity and remove files.
Store a new record.
Handle update.
Ignore fields to save.
Get validation messages.
Get all relations of model from callable.
Set action for form.
Set field and label width in current form.
Set view for form.
Set title for form.
Indicates if current form page is creating.
Indicates if current form page is editing.
Disable View Checkbox on footer.
Disable Editing Checkbox on footer.
Disable Creating Checkbox on footer.
Get current resource route url.
Render the form contents.
Get or set input data.
Getter.
Setter.
Generate a Field object and add to form builder if Field exists.
Register custom field.
Set form field alias.
Remove registered field.
Find field class.
Collect assets required by registered field.
Call the initialization closure array in sequence.
Remove files in record.
No description
Get ajax response.
Prepare input data for insert or update.
Remove ignored fields from input.
Get inputs for relations.
Get RedirectResponse after store.
Get RedirectResponse after update.
Get RedirectResponse after data saving.
Check if request is from editable.
Handle updates for single column.
Handle editable update.
No description
No description
Handle orderable update.
Update relation data.
Prepare input data for update.
No description
Prepare input data for insert.
Is input data is has-one relation.
No description
Find field object by column.
Set original data for each field.
Set all fields value in form.
Merge validation messages from input validators.
Initialize filter layout.
Don't snake case attributes.
No description
No description
No description
No description
No description
Details
in
HasHooks at line 26
protected $this
registerHook(string $name, Closure $callback)
Register a hook.
in
HasHooks at line 41
protected Response
callHooks(string $name, array $parameters = [])
Call hooks by giving name.
in
HasHooks at line 131
protected mixed
callEditing()
Call editing callbacks.
in
HasHooks at line 141
protected mixed
callSubmitted()
Call submitted callback.
in
HasHooks at line 151
protected mixed
callSaving()
Call saving callback.
in
HasHooks at line 161
protected mixed|null
callSaved()
Callback after saving a Model.
in
HasHooks at line 173
protected mixed
callDeleting(mixed $id)
Call hooks when deleting.
in
HasHooks at line 181
protected mixed
callDeleted()
No description
at line 227
__construct($model, Closure $callback = null)
Create a new form instance.
at line 249
$this
pushField(Field $field)
No description
at line 265
Model
model()
No description
at line 273
Builder
builder()
No description
at line 285
$this
edit($id)
Generate a edit form.
at line 303
$this
tab(string $title, Closure $content, $active = false)
Use tab to split form.
at line 315
Tab
getTab()
Get Tab instance.
at line 331
mixed
destroy($id)
Destroy data entity and remove files.
at line 381
RedirectResponse|Redirector|JsonResponse
store()
Store a new record.
at line 425
bool|ResponseFactory|JsonResponse|RedirectResponse|Response|mixed|null|Response
update(int $id, null $data = null)
Handle update.
at line 490
$this
ignore(string|array $fields)
Ignore fields to save.
at line 525
MessageBag|bool
validationMessages(array $input)
Get validation messages.
at line 550
array
getRelations()
Get all relations of model from callable.
at line 586
$this
setAction(string $action)
Set action for form.
at line 601
$this
setWidth(int $fieldWidth = 8, int $labelWidth = 2)
Set field and label width in current form.
at line 620
$this
setView(string $view)
Set view for form.
at line 634
$this
setTitle(string $title = '')
Set title for form.
at line 648
$this
row(Closure $callback)
Add a row in form.
at line 660
tools(Closure $callback)
Tools setting for form.
at line 684
bool
isCreating()
Indicates if current form page is creating.
at line 694
bool
isEditing()
Indicates if current form page is editing.
at line 708
$this
disableSubmit(bool $disable = true)
deprecated
deprecated
Disable form submit.
at line 724
$this
disableReset(bool $disable = true)
deprecated
deprecated
Disable form reset.
at line 738
$this
disableViewCheck(bool $disable = true)
Disable View Checkbox on footer.
at line 752
$this
disableEditingCheck(bool $disable = true)
Disable Editing Checkbox on footer.
at line 766
$this
disableCreatingCheck(bool $disable = true)
Disable Creating Checkbox on footer.
at line 778
footer(Closure $callback = null)
Footer setting for form.
at line 794
string
resource(int $slice = -2)
Get current resource route url.
at line 810
string
render()
Render the form contents.
at line 827
array|mixed
input(string $key, null $value = null)
Get or set input data.
at line 844
$this
column(int $width, Closure $closure)
Add a new layout column.
at line 860
array|mixed
__get(string $name)
Getter.
at line 873
array
__set(string $name, mixed $value)
Setter.
at line 886
Field
__call(string $method, array $arguments)
Generate a Field object and add to form builder if Field exists.
at line 904
Layout
getLayout()
No description
at line 914
static
init(Closure $callback = null)
Initialize with user pre-defined default disables, etc.
at line 927
static void
extend(string $abstract, string $class)
Register custom field.
at line 940
static void
alias(string $field, string $alias)
Set form field alias.
at line 950
static
forget(array|string $abstract)
Remove registered field.
at line 962
static bool|mixed
findFieldClass(string $method)
Find field class.
at line 983
static array
collectFieldAssets()
Collect assets required by registered field.
at line 1012
protected
callInitCallbacks()
Call the initialization closure array in sequence.
at line 1029
protected
deleteFiles(Model $model, bool $forceDelete = false)
Remove files in record.
at line 1052
protected $this|JsonResponse
responseValidationError(MessageBag $message)
No description
at line 1072
protected bool|JsonResponse
ajaxResponse(string $message)
Get ajax response.
at line 1094
protected mixed
prepare(array $data = [])
Prepare input data for insert or update.
at line 1118
protected array
removeIgnoredFields(array $input)
Remove ignored fields from input.
at line 1132
protected array
getRelationInputs(array $inputs = [])
Get inputs for relations.
at line 1156
protected RedirectResponse
redirectAfterStore()
Get RedirectResponse after store.
at line 1172
protected RedirectResponse
redirectAfterUpdate(mixed $key)
Get RedirectResponse after update.
at line 1187
protected RedirectResponse|Redirector
redirectAfterSaving(string $resourcesPath, string $key)
Get RedirectResponse after data saving.
at line 1217
protected bool
isEditable(array $input = [])
Check if request is from editable.
at line 1230
protected array|ResponseFactory|Response|Response
handleColumnUpdates(int $id, array $data)
Handle updates for single column.
at line 1255
protected array
handleEditable(array $input = [])
Handle editable update.
at line 1273
protected array
handleFileDelete(array $input = [])
No description
at line 1290
protected array
handleFileSort(array $input = [])
No description
at line 1319
protected bool
handleOrderable(int $id, array $input = [])
Handle orderable update.
at line 1341
protected void
updateRelation(array $relationsData)
Update relation data.
at line 1457
protected array
prepareUpdate(array $updates, bool $oneToOneRelation = false)
Prepare input data for update.
at line 1497
protected bool
isInvalidColumn(string|array $columns, bool $containsDot = false)
No description
at line 1516
protected array
prepareInsert($inserts)
Prepare input data for insert.
at line 1547
protected bool
isHasOneRelation(array $inserts)
Is input data is has-one relation.
at line 1568
protected array|mixed
getDataByColumn(array $data, string|array $columns)
No description
at line 1594
protected mixed
getFieldByColumn($column)
Find field object by column.
at line 1612
protected void
setFieldOriginalValue()
Set original data for each field.
at line 1630
protected void
setFieldValue($id)
Set all fields value in form.
at line 1662
protected MessageBag
mergeValidationMessages(Validator[] $validators)
Merge validation messages from input validators.
at line 1676
protected
initLayout()
Initialize filter layout.
at line 1688
static protected void
doNotSnakeAttributes(Model $model)
Don't snake case attributes.
at line 80
Code
code(mixed $column, mixed $label)
No description
at line 80
Text
text(mixed $column, mixed $label)
No description
at line 80
Checkbox
checkbox(mixed $column, mixed $label)
No description
at line 80
Radio
radio(mixed $column, mixed $label)
No description
at line 80
Select
select(mixed $column, mixed $label)
No description
at line 80
MultipleSelect
multipleSelect(mixed $column, mixed $label)
No description
at line 80
Textarea
textarea(mixed $column, mixed $label)
No description
at line 80
Hidden
hidden(mixed $column, mixed $label)
No description
at line 80
Id
id(mixed $column, mixed $label)
No description
at line 80
Ip
ip(mixed $column, mixed $label)
No description
at line 80
Url
url(mixed $column, mixed $label)
No description
at line 80
Color
color(mixed $column, mixed $label)
No description
at line 80
Email
email(mixed $column, mixed $label)
No description
at line 80
Mobile
mobile(mixed $column, mixed $label)
No description
at line 80
Slider
slider(mixed $column, mixed $label)
No description
at line 80
File
file(mixed $column, mixed $label)
No description
at line 80
Image
image(mixed $column, mixed $label)
No description
at line 80
Date
date(mixed $column, mixed $label)
No description
at line 80
Datetime
datetime(mixed $column, mixed $label)
No description
at line 80
Time
time(mixed $column, mixed $label)
No description
at line 80
Year
year(mixed $column, mixed $label)
No description
at line 80
Month
month(mixed $column, mixed $label)
No description
at line 80
DateRange
dateRange(mixed $start, mixed $end, mixed $label)
No description
at line 80
DateTimeRange
datetimeRange(mixed $start, mixed $end, mixed $label)
No description
at line 80
TimeRange
timeRange(mixed $start, mixed $end, mixed $label)
No description
at line 80
Number
number(mixed $column, mixed $label)
No description
at line 80
Currency
currency(mixed $column, mixed $label)
No description
at line 80
HasMany
hasMany(mixed $relationName, mixed $label, mixed $callback)
No description
at line 80
SwitchField
switch() $$column, $label)
No description
at line 80
Display
display(mixed $column, mixed $label)
No description
at line 80
Rate
rate(mixed $column, mixed $label)
No description
at line 80
Divider
divider(mixed $title)
No description
at line 80
Password
password(mixed $column, mixed $label)
No description
at line 80
Decimal
decimal(mixed $column, mixed $label)
No description
at line 80
Html
html(mixed $html, mixed $label)
No description
at line 80
Tags
tags(mixed $column, mixed $label)
No description
at line 80
Icon
icon(mixed $column, mixed $label)
No description
at line 80
Embeds
embeds(mixed $column, mixed $label, mixed $callback)
No description
at line 80
MultiImage
multipleImage(mixed $column, mixed $label)
No description
at line 80
MultipleFile
multipleFile(mixed $column, mixed $label)
No description
at line 80
Captcha
captcha(mixed $column, mixed $label)
No description
at line 80
Listbox
listbox(mixed $column, mixed $label)
No description
at line 80
Table
table(mixed $column, mixed $label, mixed $builder)
No description
at line 80
Timezone
timezone(mixed $column, mixed $label)
No description
at line 80
KeyValue
keyValue(mixed $column, mixed $label)
No description
at line 80
Keyword
keyWord(mixed $column, mixed $label)
No description
at line 80
ListField
list(mixed $column, mixed $label)
No description