public function radios($name, $radioOptions, $options = [])
    {
        $requiredClass = (isset($options['required']) && $options['required'] == true) ? 'required ' : '';
        $hasError = $this->errorBag->has($this->formatArrayName($name));
        $hasErrorClass = $hasError ? 'has-error' : '';

        $htmlForm = '<div class="form-group '.$requiredClass.$hasErrorClass.'">';
        $htmlForm .= $this->setFormFieldLabel($name, $options);
        $htmlForm .= '<div>';

        foreach ($radioOptions as $key => $option) {
            $value = null;
            $fieldParams = ['id' => $name.'_'.$key, 'class' => 'form-check-input'];

            if (isset($options['value']) && $options['value'] == $key) {
                $value = true;
            }
            if (isset($options['v-model'])) {
                $fieldParams += ['v-model' => $options['v-model']];
            }
            if (isset($options['required']) && $options['required'] == true) {
                $fieldParams += ['required' => true];
            }
            if ($hasError) {
                $fieldParams['class'] .= ' is-invalid';
            }

            $listStyle = isset($options['list_style']) ? $options['list_style'] : 'form-check-inline';
            $htmlForm .= '<div class="form-check '.$listStyle.'">';
            $htmlForm .= FormFacade::radio($name, $key, $value, $fieldParams);
            $htmlForm .= '<label for="'.$name.'_'.$key.'" class="form-check-label">'.$option.'</label>';
            $htmlForm .= '</div>';
        }
        $htmlForm .= '</div>';

        $htmlForm .= $this->getInfoTextLine($options);

        $htmlForm .= $this->errorBag->first($this->formatArrayName($name), '<span class="small text-danger" role="alert">:message</span>');

        $htmlForm .= '</div>';

        return $htmlForm;
    }
public function radios($name, $radioOptions, $options = [])
    {
        $requiredClass = (isset($options['required']) && $options['required'] == true) ? 'required ' : '';
        $hasError = $this->errorBag->has($this->formatArrayName($name));
        $hasErrorClass = $hasError ? 'has-error' : '';

        $htmlForm = '<div class="form-group '.$requiredClass.$hasErrorClass.'">';
        $htmlForm .= $this->setFormFieldLabel($name, $options);
        $htmlForm .= '<div>';

        foreach ($radioOptions as $key => $option) {
            $value = null;
            $fieldParams = ['id' => $name.'_'.$key, 'class' => 'form-check-input'];

            if (isset($options['value']) && $options['value'] == $key) {
                $value = true;
            }
            if (isset($options['v-model'])) {
                $fieldParams += ['v-model' => $options['v-model']];
            }
            if (isset($options['required']) && $options['required'] == true) {
                $fieldParams += ['required' => true];
            }
            if ($hasError) {
                $fieldParams['class'] .= ' is-invalid';
            }

            $listStyle = isset($options['list_style']) ? $options['list_style'] : 'form-check-inline';
            $htmlForm .= '<div class="form-check '.$listStyle.'">';
            $htmlForm .= FormFacade::radio($name, $key, $value, $fieldParams);
            $htmlForm .= '<label for="'.$name.'_'.$key.'" class="form-check-label">'.$option.'</label>';
            $htmlForm .= '</div>';
        }
        $htmlForm .= '</div>';

        $htmlForm .= $this->getInfoTextLine($options);

        $htmlForm .= $this->errorBag->first($this->formatArrayName($name), '<span class="small text-danger" role="alert">:message</span>');

        $htmlForm .= '</div>';

        return $htmlForm;
    }
public function radios ( $ name , $ radioOptions , $ options = [ ] ) { $ requiredClass = ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) ? 'required ' : '' ; $ hasError = $ this -> errorBag -> has ( $ this -> formatArrayName ( $ name ) ) ; $ hasErrorClass = $ hasError ? 'has-error' : '' ; $ htmlForm = '<div class="form-group ' . $ requiredClass . $ hasErrorClass . '">' ; $ htmlForm .= $ this -> setFormFieldLabel ( $ name , $ options ) ; $ htmlForm .= '<div>' ; foreach ( $ radioOptions as $ key => $ option ) { $ value = null ; $ fieldParams = [ 'id' => $ name . '_' . $ key , 'class' => 'form-check-input' ] ; if ( isset ( $ options [ 'value' ] ) && $ options [ 'value' ] == $ key ) { $ value = true ; } if ( isset ( $ options [ 'v-model' ] ) ) { $ fieldParams += [ 'v-model' => $ options [ 'v-model' ] ] ; } if ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) { $ fieldParams += [ 'required' => true ] ; } if ( $ hasError ) { $ fieldParams [ 'class' ] .= ' is-invalid' ; } $ listStyle = isset ( $ options [ 'list_style' ] ) ? $ options [ 'list_style' ] : 'form-check-inline' ; $ htmlForm .= '<div class="form-check ' . $ listStyle . '">' ; $ htmlForm .= FormFacade :: radio ( $ name , $ key , $ value , $ fieldParams ) ; $ htmlForm .= '<label for="' . $ name . '_' . $ key . '" class="form-check-label">' . $ option . '</label>' ; $ htmlForm .= '</div>' ; } $ htmlForm .= '</div>' ; $ htmlForm .= $ this -> getInfoTextLine ( $ options ) ; $ htmlForm .= $ this -> errorBag -> first ( $ this -> formatArrayName ( $ name ) , '<span class="small text-danger" role="alert">:message</span>' ) ; $ htmlForm .= '</div>' ; return $ htmlForm ; }
Radio field wrapped with form-group bootstrap div.

@param  string  $name  Radio field name.
@param  array|Collection  $radioOptions  Radio options.
@param  array  $options  Radio input attributes.
@return string  Generated radio input form field.
Radio field wrapped with form - group bootstrap div .