Collective\Html\FormBuilder::checkbox PHP Method

checkbox() public method

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
return Illuminate\Support\HtmlString
    public function checkbox($name, $value = 1, $checked = null, $options = [])
    {
        return $this->checkable('checkbox', $name, $value, $checked, $options);
    }

Usage Example

Example #1
0
 /**
  * Create a Bootstrap checkbox input.
  *
  * @param  string   $name
  * @param  string   $label
  * @param  string   $value
  * @param  bool     $checked
  * @param  bool     $inline
  * @param  array    $options
  * @return string
  */
 public function checkbox($name, $label, $value, $checked = null, $inline = false, array $options = [])
 {
     $labelOptions = $inline ? ['class' => 'checkbox-inline'] : [];
     $inputElement = $this->form->checkbox($name, $value, $checked, $options);
     $labelElement = '<label ' . $this->html->attributes($labelOptions) . '>' . $inputElement . $label . '</label>';
     return $inline ? $labelElement : '<div class="checkbox">' . $labelElement . '</div>';
 }
All Usage Examples Of Collective\Html\FormBuilder::checkbox