<?php namespace Orchestra\Html;

class FormBuilder extends \Illuminate\Html\FormBuilder
{
    /**
     * Create a checkboxes input field.
     *
     * @param  string  $name
     * @param  array   $list
     * @param  bool    $checked
     * @param  array   $options
     * @return string
     */
    public function checkboxes($name, $list = array(), $checked = null, $options = array())
    {
        $group = [];

        foreach ($list as $id => $label) {
            $name = str_replace('[]', '', $name);
            $identifier = sprintf('%s_%s', $name, $id);

            $options['id'] = $identifier;

            $control = $this->checkbox(
                sprintf('%s[]', $name),
                $id,
                in_array($id, (array) $checked),
                $options
            );

            $label = $this->label($identifier, $label);

            $group[] = implode(' ', [$control, $label]);
        }

        return implode('<br>', $group);
    }
}

<?php namespace Orchestra\Html;

use Illuminate\Html\FormBuilder as BaseFormBuilder;

class FormBuilder extends BaseFormBuilder
{
    /**
     * Create a checkboxes input field.
     *
     * @param  string  $name
     * @param  array   $list
     * @param  bool    $checked
     * @param  array   $options
     * @param  string  $separator
     * @return string
     */
    public function checkboxes($name, $list = [], $checked = null, $options = [], $separator = '<br>')
    {
        $group = [];

        foreach ($list as $id => $label) {
            $name = str_replace('[]', '', $name);
            $identifier = sprintf('%s_%s', $name, $id);

            $options['id'] = $identifier;

            $control = $this->checkbox(
                sprintf('%s[]', $name),
                $id,
                in_array($id, (array) $checked),
                $options
            );

            $label = $this->label($identifier, $label);

            $group[] = implode(' ', [$control, $label]);
        }

        return implode($separator, $group);
    }
}

Allow Form::checkboxes() to customize output separator.
Allow Form::checkboxes() to customize output separator.

Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>
