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 |
static array | $availableFields | Available fields. |
|
static array | $fieldAlias | Form field alias. |
|
static protected | $initCallbacks | Initialization closure array. |
|
array | $rows | Field rows in form. |
|
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 |
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.
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 94
protected $this
registerHook(string $name, Closure $callback)
Register a hook.
in
HasHooks at line 107
protected
callHooks(string $name, array $parameters = [])
Call hooks by giving name.
in
HasHooks at line 129
protected mixed
callEditing()
Call editing callbacks.
in
HasHooks at line 139
protected mixed
callSubmitted()
Call submitted callback.
in
HasHooks at line 149
protected mixed
callSaving()
Call saving callback.
in
HasHooks at line 159
protected mixed|null
callSaved()
Callback after saving a Model.
in
HasHooks at line 171
protected mixed
callDeleting(mixed $id)
Call hooks when deleting.
in
HasHooks at line 179
protected mixed
callDeleted()
No description
at line 177
__construct($model, Closure $callback = null)
Create a new form instance.
at line 199
$this
pushField(Field $field)
No description
at line 215
Model
model()
No description
at line 223
Builder
builder()
No description
at line 235
$this
edit($id)
Generate a edit form.
at line 253
$this
tab(string $title, Closure $content, $active = false)
Use tab to split form.
at line 265
Tab
getTab()
Get Tab instance.
at line 281
mixed
destroy($id)
Destroy data entity and remove files.
at line 331
RedirectResponse|Redirector|JsonResponse
store()
Store a new record.
at line 375
bool|ResponseFactory|JsonResponse|RedirectResponse|Response|mixed|null|Response
update(int $id, null $data = null)
Handle update.
at line 440
$this
ignore(string|array $fields)
Ignore fields to save.
at line 454
MessageBag|bool
validationMessages(array $input)
Get validation messages.
at line 479
array
getRelations()
Get all relations of model from callable.
at line 515
$this
setAction(string $action)
Set action for form.
at line 530
$this
setWidth(int $fieldWidth = 8, int $labelWidth = 2)
Set field and label width in current form.
at line 549
$this
setView(string $view)
Set view for form.
at line 563
$this
setTitle(string $title = '')
Set title for form.
at line 577
$this
row(Closure $callback)
Add a row in form.
at line 589
tools(Closure $callback)
Tools setting for form.
at line 613
bool
isCreating()
Indicates if current form page is creating.
at line 623
bool
isEditing()
Indicates if current form page is editing.
at line 635
$this
disableViewCheck(bool $disable = true)
Disable View Checkbox on footer.
at line 649
$this
disableEditingCheck(bool $disable = true)
Disable Editing Checkbox on footer.
at line 663
$this
disableCreatingCheck(bool $disable = true)
Disable Creating Checkbox on footer.
at line 675
footer(Closure $callback = null)
Footer setting for form.
at line 691
string
resource(int $slice = -2)
Get current resource route url.
at line 707
string
render()
Render the form contents.
at line 724
array|mixed
input(string $key, null $value = null)
Get or set input data.
at line 741
$this
column(int $width, Closure $closure)
Add a new layout column.
at line 757
array|mixed
__get(string $name)
Getter.
at line 770
array
__set(string $name, mixed $value)
Setter.
at line 783
Field
__call(string $method, array $arguments)
Generate a Field object and add to form builder if Field exists.
at line 801
Layout
getLayout()
No description
at line 811
static
init(Closure $callback = null)
Initialize with user pre-defined default disables, etc.
at line 824
static void
extend(string $abstract, string $class)
Register custom field.
at line 837
static void
alias(string $field, string $alias)
Set form field alias.
at line 847
static
forget(array|string $abstract)
Remove registered field.
at line 859
static bool|mixed
findFieldClass(string $method)
Find field class.
at line 884
protected
callInitCallbacks()
Call the initialization closure array in sequence.
at line 901
protected
deleteFiles(Model $model, bool $forceDelete = false)
Remove files in record.
at line 924
protected $this|JsonResponse
responseValidationError(MessageBag $message)
No description
at line 944
protected bool|JsonResponse
ajaxResponse(string $message)
Get ajax response.
at line 966
protected mixed
prepare(array $data = [])
Prepare input data for insert or update.
at line 990
protected array
removeIgnoredFields(array $input)
Remove ignored fields from input.
at line 1004
protected array
getRelationInputs(array $inputs = [])
Get inputs for relations.
at line 1028
protected RedirectResponse
redirectAfterStore()
Get RedirectResponse after store.
at line 1044
protected RedirectResponse
redirectAfterUpdate(mixed $key)
Get RedirectResponse after update.
at line 1059
protected RedirectResponse|Redirector
redirectAfterSaving(string $resourcesPath, string $key)
Get RedirectResponse after data saving.
at line 1086
protected bool
isEditable(array $input = [])
Check if request is from editable.
at line 1099
protected array|ResponseFactory|Response|Response
handleColumnUpdates(int $id, array $data)
Handle updates for single column.
at line 1124
protected array
handleEditable(array $input = [])
Handle editable update.
at line 1142
protected array
handleFileDelete(array $input = [])
No description
at line 1159
protected array
handleFileSort(array $input = [])
No description
at line 1188
protected bool
handleOrderable(int $id, array $input = [])
Handle orderable update.
at line 1210
protected void
updateRelation(array $relationsData)
Update relation data.
at line 1326
protected array
prepareUpdate(array $updates, bool $oneToOneRelation = false)
Prepare input data for update.
at line 1366
protected bool
isInvalidColumn(string|array $columns, bool $containsDot = false)
No description
at line 1385
protected array
prepareInsert($inserts)
Prepare input data for insert.
at line 1416
protected bool
isHasOneRelation(array $inserts)
Is input data is has-one relation.
at line 1437
protected array|mixed
getDataByColumn(array $data, string|array $columns)
No description
at line 1463
protected mixed
getFieldByColumn($column)
Find field object by column.
at line 1481
protected void
setFieldOriginalValue()
Set original data for each field.
at line 1499
protected void
setFieldValue($id)
Set all fields value in form.
at line 1531
protected MessageBag
mergeValidationMessages(Validator[] $validators)
Merge validation messages from input validators.
at line 1545
protected
initLayout()
Initialize filter layout.
at line 1557
static protected void
doNotSnakeAttributes(Model $model)
Don't snake case attributes.
at line 72
Captcha
captcha(mixed $column, mixed $label)
No description
at line 72
Code
code(mixed $column, mixed $label)
No description
at line 72
Text
text(mixed $column, mixed $label)
No description
at line 72
Checkbox
checkbox(mixed $column, mixed $label)
No description
at line 72
Radio
radio(mixed $column, mixed $label)
No description
at line 72
Select
select(mixed $column, mixed $label)
No description
at line 72
MultipleSelect
multipleSelect(mixed $column, mixed $label)
No description
at line 72
Textarea
textarea(mixed $column, mixed $label)
No description
at line 72
Hidden
hidden(mixed $column, mixed $label)
No description
at line 72
Id
id(mixed $column, mixed $label)
No description
at line 72
Ip
ip(mixed $column, mixed $label)
No description
at line 72
Url
url(mixed $column, mixed $label)
No description
at line 72
Color
color(mixed $column, mixed $label)
No description
at line 72
Email
email(mixed $column, mixed $label)
No description
at line 72
Mobile
mobile(mixed $column, mixed $label)
No description
at line 72
File
file(mixed $column, mixed $label)
No description
at line 72
Image
image(mixed $column, mixed $label)
No description
at line 72
Date
date(mixed $column, mixed $label)
No description
at line 72
Datetime
datetime(mixed $column, mixed $label)
No description
at line 72
Time
time(mixed $column, mixed $label)
No description
at line 72
Year
year(mixed $column, mixed $label)
No description
at line 72
Month
month(mixed $column, mixed $label)
No description
at line 72
DateRange
dateRange(mixed $start, mixed $end, mixed $label)
No description
at line 72
DateTimeRange
datetimeRange(mixed $start, mixed $end, mixed $label)
No description
at line 72
TimeRange
timeRange(mixed $start, mixed $end, mixed $label)
No description
at line 72
Number
number(mixed $column, mixed $label)
No description
at line 72
Currency
currency(mixed $column, mixed $label)
No description
at line 72
SwitchField
switch() $$column, $label)
No description
at line 72
Display
display(mixed $column, mixed $label)
No description
at line 72
Divider
divider(mixed $title)
No description
at line 72
Password
password(mixed $column, mixed $label)
No description
at line 72
Decimal
decimal(mixed $column, mixed $label)
No description
at line 72
Html
html(mixed $html, mixed $label)
No description
at line 72
Tags
tags(mixed $column, mixed $label)
No description
at line 72
MultiImage
multipleImage(mixed $column, mixed $label)
No description
at line 72
Timezone
timezone(mixed $column, mixed $label)
No description
at line 72
TableInput
tableInput(mixed $column, mixed $label)
No description
at line 72
Keyword
keyWord(mixed $column, mixed $label)
No description