src/FormBuilder.php
public function radios($name, $options = array(), $selected = null, $attributes = array(), $hasErrors = false)
    {
        $selected = $this->getValueAttribute($name, $selected);

        $defaultTemplate = in_array('inline', $attributes)
            ? 'forms.radios-inline'
            : 'forms.radios';

        $template = isset($attributes['template'])
            ? $attributes['template']
            : null;

        $radios = [];

        foreach ($options as $value => $label) {
            $radios[] = [
                'name'     => $name,
                'value'    => $value,
                'label'    => $label,
                'selected' => $selected == $value,
                'id'       => $name.'_'.Str::slug($value),
            ];
        }

        unset ($attributes['inline'], $attributes['template']);

        return $this->theme->render(
            $template,
            compact('name', 'radios', 'attributes', 'hasErrors'),
            $defaultTemplate
        );
    }
public function radios($name, $options = array(), $selected = null, $attributes = array(), $hasErrors = false)
    {
        $selected = $this->getValueAttribute($name, $selected);

        $defaultTemplate = in_array('inline', $attributes)
            ? 'forms.radios-inline'
            : 'forms.radios';

        $template = isset($attributes['template'])
            ? $attributes['template']
            : null;

        $radios = [];

        foreach ($options as $value => $label) {
            $radios[] = [
                'name'     => $name,
                'value'    => $value,
                'label'    => $label,
                'selected' => $selected == $value,
                'id'       => $name.'_'.Str::slug($value),
            ];
        }

        unset ($attributes['inline'], $attributes['template']);

        return $this->theme->render(
            $template,
            compact('name', 'radios', 'attributes', 'hasErrors'),
            $defaultTemplate
        );
    }
public function radios ( $ name , $ options = array ( ) , $ selected = null , $ attributes = array ( ) , $ hasErrors = false ) { $ selected = $ this -> getValueAttribute ( $ name , $ selected ) ; $ defaultTemplate = in_array ( 'inline' , $ attributes ) ? 'forms.radios-inline' : 'forms.radios' ; $ template = isset ( $ attributes [ 'template' ] ) ? $ attributes [ 'template' ] : null ; $ radios = [ ] ; foreach ( $ options as $ value => $ label ) { $ radios [ ] = [ 'name' => $ name , 'value' => $ value , 'label' => $ label , 'selected' => $ selected == $ value , 'id' => $ name . '_' . Str :: slug ( $ value ) , ] ; } unset ( $ attributes [ 'inline' ] , $ attributes [ 'template' ] ) ; return $ this -> theme -> render ( $ template , compact ( 'name' , 'radios' , 'attributes' , 'hasErrors' ) , $ defaultTemplate ) ; }
Create a list of radios.

This function is very similar to Form::select but it generates a
collection of radios instead of options.

i.e. Form::radios('status', ['a' => 'Active', 'i' => 'Inactive'])

You can pass 'inline' as a value of the attribute's array, to set the
radios as inline (they'll be rendered with the 'radios-inline' template).

@param string $name
@param array  $options
@param string $selected
@param array  $attributes
@param bool   $hasErrors

@return string
Create a list of radios .