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

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

        if (isset($options['value'])) {
            $value = $options['value'];
            if (is_array($options['value'])) {
                $value = new Collection($options['value']);
            }
        } else {
            $value = new Collection();
        }

        foreach ($checkboxOptions as $key => $option) {
            $fieldParams = ['id' => $name.'_'.$key, 'class' => 'form-check-input'];
            if (isset($options['v-model'])) {
                $fieldParams += ['v-model' => $options['v-model']];
            }
            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::checkbox($name.'[]', $key, $value->contains($key), $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 checkboxes($name, array $checkboxOptions, $options = [])
    {
        $requiredClass = (isset($options['required']) && $options['required'] == true) ? 'required ' : '';
        $hasError = $this->errorBag->has($name);
        $hasErrorClass = $hasError ? 'has-error' : '';

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

        if (isset($options['value'])) {
            $value = $options['value'];
            if (is_array($options['value'])) {
                $value = new Collection($options['value']);
            }
        } else {
            $value = new Collection();
        }

        foreach ($checkboxOptions as $key => $option) {
            $fieldParams = ['id' => $name.'_'.$key, 'class' => 'form-check-input'];
            if (isset($options['v-model'])) {
                $fieldParams += ['v-model' => $options['v-model']];
            }
            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::checkbox($name.'[]', $key, $value->contains($key), $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 checkboxes ( $ name , array $ checkboxOptions , $ options = [ ] ) { $ requiredClass = ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) ? 'required ' : '' ; $ hasError = $ this -> errorBag -> has ( $ name ) ; $ hasErrorClass = $ hasError ? 'has-error' : '' ; $ htmlForm = '<div class="form-group ' . $ requiredClass . $ hasErrorClass . '">' ; $ htmlForm .= $ this -> setFormFieldLabel ( $ name , $ options ) ; $ htmlForm .= '<div>' ; if ( isset ( $ options [ 'value' ] ) ) { $ value = $ options [ 'value' ] ; if ( is_array ( $ options [ 'value' ] ) ) { $ value = new Collection ( $ options [ 'value' ] ) ; } } else { $ value = new Collection ( ) ; } foreach ( $ checkboxOptions as $ key => $ option ) { $ fieldParams = [ 'id' => $ name . '_' . $ key , 'class' => 'form-check-input' ] ; if ( isset ( $ options [ 'v-model' ] ) ) { $ fieldParams += [ 'v-model' => $ options [ 'v-model' ] ] ; } 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 :: checkbox ( $ name . '[]' , $ key , $ value -> contains ( $ key ) , $ 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 ; }
Multi checkbox with array input, wrapped with bootstrap form-group div.

@param  string  $name   Name of checkbox field which become an array input.
@param  array  $checkboxOptions  Checkbox options.
@param  array  $options  Checkbox input attributes.
@return string  Generated multi-checkboxes input.
Multi checkbox with array input wrapped with bootstrap form - group div .