Collective\Html\FormBuilder::checkable PHP Method

checkable() protected method

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
return Illuminate\Support\HtmlString
    protected function checkable($type, $name, $value, $checked, $options)
    {
        $checked = $this->getCheckedState($type, $name, $value, $checked);
        if ($checked) {
            $options['checked'] = 'checked';
        }
        return $this->input($type, $name, $value, $options);
    }

Usage Example

 /**
  * @param $name
  * @param $labelText
  * @param int $value
  * @param null $checked
  * @param array $options
  * @return string
  */
 public function wrappedCheckbox($name, $labelText, $value = 1, $checked = null, $options = [])
 {
     return $this->wrapWithLabel($name, $labelText, $options, parent::checkable('checkbox', $name, $value, $checked, $this->appendErrors($name, $options)));
 }
All Usage Examples Of Collective\Html\FormBuilder::checkable