public function select(
        $name,
        $list = [],
        $selected = [],
        array $selectAttributes = [],
        array $optionsAttributes = [],
        array $spanAttributes = [],
        $selectOnly = false
    ) {
        // Forces the ID attribute
        $selectAttributes['id'] = $name.'-ms';
        if (!isset($selectAttributes['class'])) {
            $selectAttributes['class'] = 'multiselect';
        }

        // We will concatenate the span html unless $selectOnly is passed as false
        $spanHtml = $selectOnly ? '' : $this->span($name, $list, $selected, $spanAttributes);

        // Here, we generate the list of options
        $html = [];
        if (isset($selectAttributes['placeholder'])) {
            $html[] = $this->option($selectAttributes['placeholder'], '');
            unset($selectAttributes['placeholder']);
        } else {
            $html[] = $this->option('&nbsp;', '');
        }
        foreach ($list as $value => $display) {
            $optionAttributes = isset($optionsAttributes[$value]) ? $optionsAttributes[$value] : [];
            $html[] = $this->option($display, $value, $optionAttributes);
        }
        $list = implode('', $html);

        $selectAttributes = $this->attributes($selectAttributes);

        return $this->toHtmlString($spanHtml."<select{$selectAttributes}>{$list}</select>");
    }
public function select(
        $name,
        $list = [],
        $selected = [],
        array $selectAttributes = [],
        array $optionsAttributes = [],
        array $spanAttributes = [],
        $selectOnly = false
    ) {
        // Forces the ID attribute
        $selectAttributes['id'] = $name.'-ms';
        if (!isset($selectAttributes['class'])) {
            $selectAttributes['class'] = 'multiselect';
        }

        // We will concatenate the span html unless $selectOnly is passed as false
        $spanHtml = $selectOnly ? '' : $this->span($name, $list, $selected, $spanAttributes);

        // Here, we generate the list of options
        $html = [];
        if (isset($selectAttributes['placeholder'])) {
            $html[] = $this->option($selectAttributes['placeholder'], '');
            unset($selectAttributes['placeholder']);
        } else {
            $html[] = $this->option('&nbsp;', '');
        }
        foreach ($list as $value => $display) {
            $optionAttributes = isset($optionsAttributes[$value]) ? $optionsAttributes[$value] : [];
            $html[] = $this->option($display, $value, $optionAttributes);
        }
        $list = implode('', $html);

        $selectAttributes = $this->attributes($selectAttributes);

        return $this->toHtmlString($spanHtml."<select{$selectAttributes}>{$list}</select>");
    }
public function select ( $ name , $ list = [ ] , $ selected = [ ] , array $ selectAttributes = [ ] , array $ optionsAttributes = [ ] , array $ spanAttributes = [ ] , $ selectOnly = false ) { // Forces the ID attribute $ selectAttributes [ 'id' ] = $ name . '-ms' ; if ( ! isset ( $ selectAttributes [ 'class' ] ) ) { $ selectAttributes [ 'class' ] = 'multiselect' ; } // We will concatenate the span html unless $selectOnly is passed as false $ spanHtml = $ selectOnly ? '' : $ this -> span ( $ name , $ list , $ selected , $ spanAttributes ) ; // Here, we generate the list of options $ html = [ ] ; if ( isset ( $ selectAttributes [ 'placeholder' ] ) ) { $ html [ ] = $ this -> option ( $ selectAttributes [ 'placeholder' ] , '' ) ; unset ( $ selectAttributes [ 'placeholder' ] ) ; } else { $ html [ ] = $ this -> option ( '&nbsp;' , '' ) ; } foreach ( $ list as $ value => $ display ) { $ optionAttributes = isset ( $ optionsAttributes [ $ value ] ) ? $ optionsAttributes [ $ value ] : [ ] ; $ html [ ] = $ this -> option ( $ display , $ value , $ optionAttributes ) ; } $ list = implode ( '' , $ html ) ; $ selectAttributes = $ this -> attributes ( $ selectAttributes ) ; return $ this -> toHtmlString ( $ spanHtml . "<select{$selectAttributes}>{$list}</select>" ) ; }
Create the multi-select select box field and optionally the already selected span field.
This method interface mimicks LaravelCollective\html select method.

@param string $name              The name of the select element. Will be used by the JS to add hidden inputs
@param array  $list              A Laravel collection or list of key => values
@param array  $selected          A laravel collection or list of keys
@param array  $selectAttributes
@param array  $optionsAttributes
@param array  $spanAttributes
@param bool   $selectOnly

@return \Illuminate\Support\HtmlString
Create the multi - select select box field and optionally the already selected span field . This method interface mimicks LaravelCollective \ html select method .