Collective\Html\FormBuilder::radio PHP Method

radio() public method

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

Usage Example

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