PHP Класс Collective\Html\FormBuilder

Наследование: use trait Illuminate\Support\Traits\Macroable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$csrfToken string The CSRF token used by the form builder.
$html HtmlBuilder The HTML builder instance.
$labels array An array of label names we've created.
$model mixed The current model instance for the form.
$reserved array The reserved form open attributes.
$session Illuminate\Session\SessionInterface The session store implementation.
$skipValueTypes array The types of inputs to not fill values on by default.
$spoofedMethods array The form methods that should be spoofed, in uppercase.
$url Illuminate\Contracts\Routing\UrlGenerator The URL generator instance.
$view Illuminate\Contracts\View\Factory The View factory instance.

Открытые методы

Метод Описание
__call ( string $method, array $parameters ) : Illuminate\Contracts\View\View | mixed Dynamically handle calls to the class.
__construct ( HtmlBuilder $html, Illuminate\Contracts\Routing\UrlGenerator $url, Illuminate\Contracts\View\Factory $view, string $csrfToken ) Create a new form builder instance.
button ( string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a button element.
checkbox ( string $name, mixed $value = 1, boolean $checked = null, array $options = [] ) : Illuminate\Support\HtmlString Create a checkbox input field.
close ( ) : string Close the current form.
color ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a color input field.
componentCall ( )
date ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a date input field.
datetime ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a datetime input field.
datetimeLocal ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a datetime-local input field.
email ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create an e-mail input field.
file ( string $name, array $options = [] ) : Illuminate\Support\HtmlString Create a file input field.
getIdAttribute ( string $name, array $attributes ) : string Get the ID attribute for a field name.
getSelectOption ( string $display, string $value, string $selected ) : Illuminate\Support\HtmlString Get the select option for the given value.
getSessionStore ( ) : Illuminate\Session\SessionInterface Get the session store implementation.
getValueAttribute ( string $name, string $value = null ) : mixed Get the value that should be assigned to the field.
hidden ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a hidden input field.
image ( string $url, string $name = null, array $attributes = [] ) : Illuminate\Support\HtmlString Create a HTML image input element.
input ( string $type, string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a form input field.
label ( string $name, string $value = null, array $options = [], boolean $escape_html = true ) : Illuminate\Support\HtmlString Create a form label element.
macroCall ( )
model ( mixed $model, array $options = [] ) : Illuminate\Support\HtmlString Create a new model based form builder.
number ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a number input field.
old ( string $name ) : mixed Get a value from the session's old input.
oldInputIsEmpty ( ) : boolean Determine if the old input is empty.
open ( array $options = [] ) : Illuminate\Support\HtmlString Open up a new HTML form.
password ( string $name, array $options = [] ) : Illuminate\Support\HtmlString Create a password input field.
radio ( string $name, mixed $value = null, boolean $checked = null, array $options = [] ) : Illuminate\Support\HtmlString Create a radio button input field.
reset ( string $value, array $attributes = [] ) : Illuminate\Support\HtmlString Create a HTML reset input element.
select ( string $name, array $list = [], string $selected = null, array $options = [] ) : Illuminate\Support\HtmlString Create a select box field.
selectMonth ( string $name, string $selected = null, array $options = [], string $format = '%B' ) : Illuminate\Support\HtmlString Create a select month field.
selectRange ( string $name, string $begin, string $end, string $selected = null, array $options = [] ) : Illuminate\Support\HtmlString Create a select range field.
selectYear ( ) : mixed Create a select year field.
setModel ( mixed $model ) : void Set the model instance on the form builder.
setSessionStore ( Illuminate\Session\SessionInterface $session ) Set the session store implementation.
submit ( string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a submit button element.
tel ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a tel input field.
text ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a text input field.
textarea ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a textarea input field.
time ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a time input field.
token ( ) : string Generate a hidden field with the current CSRF token.
url ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString Create a url input field.

Защищенные методы

Метод Описание
checkable ( string $type, string $name, mixed $value, boolean $checked, array $options ) : Illuminate\Support\HtmlString Create a checkable input field.
formatLabel ( string $name, string | null $value ) : string Format the label value.
getAction ( array $options ) : string Get the form action from the options.
getAppendage ( string $method ) : string Get the form appendage for the given method.
getCheckboxCheckedState ( string $name, mixed $value, boolean $checked ) : boolean Get the check state for a checkbox input.
getCheckedState ( string $type, string $name, mixed $value, boolean $checked ) : boolean Get the check state for a checkable input.
getControllerAction ( array | string $options ) : string Get the action for an "action" option.
getMethod ( string $method ) : string Parse the form action method.
getModelValueAttribute ( string $name ) : mixed Get the model value that should be assigned to the field.
getRadioCheckedState ( string $name, mixed $value, boolean $checked ) : boolean Get the check state for a radio input.
getRouteAction ( array | string $options ) : string Get the action for a "route" option.
getSelectedValue ( string $value, string $selected ) : null | string Determine if the value is selected.
getUrlAction ( array | string $options ) : string Get the action for a "url" option.
missingOldAndModel ( string $name ) : boolean Determine if old input or model input exists for a key.
option ( string $display, string $value, string $selected ) : Illuminate\Support\HtmlString Create a select element option.
optionGroup ( array $list, string $label, string $selected ) : Illuminate\Support\HtmlString Create an option group form element.
placeholderOption ( $display, $selected ) : Illuminate\Support\HtmlString Create a placeholder select element option.
setQuickTextAreaSize ( array $options ) : array Set the text area size using the quick "size" attribute.
setTextAreaSize ( array $options ) : array Set the text area size on the attributes.
toHtmlString ( $html ) : Illuminate\Support\HtmlString Transform the string to an Html serializable object
transformKey ( string $key ) : mixed Transform key from array to dot syntax.

Описание методов

__call() публичный Метод

Dynamically handle calls to the class.
public __call ( string $method, array $parameters ) : Illuminate\Contracts\View\View | mixed
$method string
$parameters array
Результат Illuminate\Contracts\View\View | mixed

__construct() публичный Метод

Create a new form builder instance.
public __construct ( HtmlBuilder $html, Illuminate\Contracts\Routing\UrlGenerator $url, Illuminate\Contracts\View\Factory $view, string $csrfToken )
$html HtmlBuilder
$url Illuminate\Contracts\Routing\UrlGenerator
$view Illuminate\Contracts\View\Factory
$csrfToken string

button() публичный Метод

Create a button element.
public button ( string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$value string
$options array
Результат Illuminate\Support\HtmlString

checkable() защищенный Метод

Create a checkable input field.
protected checkable ( string $type, string $name, mixed $value, boolean $checked, array $options ) : Illuminate\Support\HtmlString
$type string
$name string
$value mixed
$checked boolean
$options array
Результат Illuminate\Support\HtmlString

checkbox() публичный Метод

Create a checkbox input field.
public checkbox ( string $name, mixed $value = 1, boolean $checked = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value mixed
$checked boolean
$options array
Результат Illuminate\Support\HtmlString

close() публичный Метод

Close the current form.
public close ( ) : string
Результат string

color() публичный Метод

Create a color input field.
public color ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

componentCall() публичный Метод

public componentCall ( )

date() публичный Метод

Create a date input field.
public date ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

datetime() публичный Метод

Create a datetime input field.
public datetime ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

datetimeLocal() публичный Метод

Create a datetime-local input field.
public datetimeLocal ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

email() публичный Метод

Create an e-mail input field.
public email ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

file() публичный Метод

Create a file input field.
public file ( string $name, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$options array
Результат Illuminate\Support\HtmlString

formatLabel() защищенный Метод

Format the label value.
protected formatLabel ( string $name, string | null $value ) : string
$name string
$value string | null
Результат string

getAction() защищенный Метод

Get the form action from the options.
protected getAction ( array $options ) : string
$options array
Результат string

getAppendage() защищенный Метод

Get the form appendage for the given method.
protected getAppendage ( string $method ) : string
$method string
Результат string

getCheckboxCheckedState() защищенный Метод

Get the check state for a checkbox input.
protected getCheckboxCheckedState ( string $name, mixed $value, boolean $checked ) : boolean
$name string
$value mixed
$checked boolean
Результат boolean

getCheckedState() защищенный Метод

Get the check state for a checkable input.
protected getCheckedState ( string $type, string $name, mixed $value, boolean $checked ) : boolean
$type string
$name string
$value mixed
$checked boolean
Результат boolean

getControllerAction() защищенный Метод

Get the action for an "action" option.
protected getControllerAction ( array | string $options ) : string
$options array | string
Результат string

getIdAttribute() публичный Метод

Get the ID attribute for a field name.
public getIdAttribute ( string $name, array $attributes ) : string
$name string
$attributes array
Результат string

getMethod() защищенный Метод

Parse the form action method.
protected getMethod ( string $method ) : string
$method string
Результат string

getModelValueAttribute() защищенный Метод

Get the model value that should be assigned to the field.
protected getModelValueAttribute ( string $name ) : mixed
$name string
Результат mixed

getRadioCheckedState() защищенный Метод

Get the check state for a radio input.
protected getRadioCheckedState ( string $name, mixed $value, boolean $checked ) : boolean
$name string
$value mixed
$checked boolean
Результат boolean

getRouteAction() защищенный Метод

Get the action for a "route" option.
protected getRouteAction ( array | string $options ) : string
$options array | string
Результат string

getSelectOption() публичный Метод

Get the select option for the given value.
public getSelectOption ( string $display, string $value, string $selected ) : Illuminate\Support\HtmlString
$display string
$value string
$selected string
Результат Illuminate\Support\HtmlString

getSelectedValue() защищенный Метод

Determine if the value is selected.
protected getSelectedValue ( string $value, string $selected ) : null | string
$value string
$selected string
Результат null | string

getSessionStore() публичный Метод

Get the session store implementation.
public getSessionStore ( ) : Illuminate\Session\SessionInterface
Результат Illuminate\Session\SessionInterface $session

getUrlAction() защищенный Метод

Get the action for a "url" option.
protected getUrlAction ( array | string $options ) : string
$options array | string
Результат string

getValueAttribute() публичный Метод

Get the value that should be assigned to the field.
public getValueAttribute ( string $name, string $value = null ) : mixed
$name string
$value string
Результат mixed

hidden() публичный Метод

Create a hidden input field.
public hidden ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

image() публичный Метод

Create a HTML image input element.
public image ( string $url, string $name = null, array $attributes = [] ) : Illuminate\Support\HtmlString
$url string
$name string
$attributes array
Результат Illuminate\Support\HtmlString

input() публичный Метод

Create a form input field.
public input ( string $type, string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$type string
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

label() публичный Метод

Create a form label element.
public label ( string $name, string $value = null, array $options = [], boolean $escape_html = true ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
$escape_html boolean
Результат Illuminate\Support\HtmlString

macroCall() публичный Метод

public macroCall ( )

missingOldAndModel() защищенный Метод

Determine if old input or model input exists for a key.
protected missingOldAndModel ( string $name ) : boolean
$name string
Результат boolean

model() публичный Метод

Create a new model based form builder.
public model ( mixed $model, array $options = [] ) : Illuminate\Support\HtmlString
$model mixed
$options array
Результат Illuminate\Support\HtmlString

number() публичный Метод

Create a number input field.
public number ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

old() публичный Метод

Get a value from the session's old input.
public old ( string $name ) : mixed
$name string
Результат mixed

oldInputIsEmpty() публичный Метод

Determine if the old input is empty.
public oldInputIsEmpty ( ) : boolean
Результат boolean

open() публичный Метод

Open up a new HTML form.
public open ( array $options = [] ) : Illuminate\Support\HtmlString
$options array
Результат Illuminate\Support\HtmlString

option() защищенный Метод

Create a select element option.
protected option ( string $display, string $value, string $selected ) : Illuminate\Support\HtmlString
$display string
$value string
$selected string
Результат Illuminate\Support\HtmlString

optionGroup() защищенный Метод

Create an option group form element.
protected optionGroup ( array $list, string $label, string $selected ) : Illuminate\Support\HtmlString
$list array
$label string
$selected string
Результат Illuminate\Support\HtmlString

password() публичный Метод

Create a password input field.
public password ( string $name, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$options array
Результат Illuminate\Support\HtmlString

placeholderOption() защищенный Метод

Create a placeholder select element option.
protected placeholderOption ( $display, $selected ) : Illuminate\Support\HtmlString
$display
$selected
Результат Illuminate\Support\HtmlString

radio() публичный Метод

Create a radio button input field.
public radio ( string $name, mixed $value = null, boolean $checked = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value mixed
$checked boolean
$options array
Результат Illuminate\Support\HtmlString

reset() публичный Метод

Create a HTML reset input element.
public reset ( string $value, array $attributes = [] ) : Illuminate\Support\HtmlString
$value string
$attributes array
Результат Illuminate\Support\HtmlString

select() публичный Метод

Create a select box field.
public select ( string $name, array $list = [], string $selected = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$list array
$selected string
$options array
Результат Illuminate\Support\HtmlString

selectMonth() публичный Метод

Create a select month field.
public selectMonth ( string $name, string $selected = null, array $options = [], string $format = '%B' ) : Illuminate\Support\HtmlString
$name string
$selected string
$options array
$format string
Результат Illuminate\Support\HtmlString

selectRange() публичный Метод

Create a select range field.
public selectRange ( string $name, string $begin, string $end, string $selected = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$begin string
$end string
$selected string
$options array
Результат Illuminate\Support\HtmlString

selectYear() публичный Метод

Create a select year field.
public selectYear ( ) : mixed
Результат mixed

setModel() публичный Метод

Set the model instance on the form builder.
public setModel ( mixed $model ) : void
$model mixed
Результат void

setQuickTextAreaSize() защищенный Метод

Set the text area size using the quick "size" attribute.
protected setQuickTextAreaSize ( array $options ) : array
$options array
Результат array

setSessionStore() публичный Метод

Set the session store implementation.
public setSessionStore ( Illuminate\Session\SessionInterface $session )
$session Illuminate\Session\SessionInterface

setTextAreaSize() защищенный Метод

Set the text area size on the attributes.
protected setTextAreaSize ( array $options ) : array
$options array
Результат array

submit() публичный Метод

Create a submit button element.
public submit ( string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$value string
$options array
Результат Illuminate\Support\HtmlString

tel() публичный Метод

Create a tel input field.
public tel ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

text() публичный Метод

Create a text input field.
public text ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

textarea() публичный Метод

Create a textarea input field.
public textarea ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

time() публичный Метод

Create a time input field.
public time ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

toHtmlString() защищенный Метод

Transform the string to an Html serializable object
protected toHtmlString ( $html ) : Illuminate\Support\HtmlString
$html
Результат Illuminate\Support\HtmlString

token() публичный Метод

Generate a hidden field with the current CSRF token.
public token ( ) : string
Результат string

transformKey() защищенный Метод

Transform key from array to dot syntax.
protected transformKey ( string $key ) : mixed
$key string
Результат mixed

url() публичный Метод

Create a url input field.
public url ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
Результат Illuminate\Support\HtmlString

Описание свойств

$csrfToken защищенное свойство

The CSRF token used by the form builder.
protected string $csrfToken
Результат string

$html защищенное свойство

The HTML builder instance.
protected HtmlBuilder,Collective\Html $html
Результат HtmlBuilder

$labels защищенное свойство

An array of label names we've created.
protected array $labels
Результат array

$model защищенное свойство

The current model instance for the form.
protected mixed $model
Результат mixed

$reserved защищенное свойство

The reserved form open attributes.
protected array $reserved
Результат array

$session защищенное свойство

The session store implementation.
protected SessionInterface,Illuminate\Session $session
Результат Illuminate\Session\SessionInterface

$skipValueTypes защищенное свойство

The types of inputs to not fill values on by default.
protected array $skipValueTypes
Результат array

$spoofedMethods защищенное свойство

The form methods that should be spoofed, in uppercase.
protected array $spoofedMethods
Результат array

$url защищенное свойство

The URL generator instance.
protected UrlGenerator,Illuminate\Contracts\Routing $url
Результат Illuminate\Contracts\Routing\UrlGenerator

$view защищенное свойство

The View factory instance.
protected Factory,Illuminate\Contracts\View $view
Результат Illuminate\Contracts\View\Factory