src/Services/NestableService.php
protected function doSelect($value, $label)
    {
        if ($this->selected) {
            if (is_array($this->selected) && count($this->selected) > 0) {
                $result = array_search($value, $this->selected);

                if ($result !== false) {
                    unset($this->selected[$result]);

                    return 'selected="selected"';
                }
            } elseif ($this->selected instanceof Closure) {
                call_user_func_array($this->selected, [$this, $value, $label]);
                $attrs = $this->renderAttr($this->optionAttr);
                $this->optionAttr = null;
                return $attrs;
            } else {
                if ($this->selected == $value) {
                    $this->selected = null;

                    return 'selected="selected"';
                }
            }
        }
    }
protected function doSelect($value, $label)
    {
        if ($this->selected) {
            if (is_array($this->selected) && count($this->selected) > 0) {
                $result = array_search($value, $this->selected);

                if ($result !== false) {
                    unset($this->selected[$result]);

                    return 'selected="selected"';
                }
            } elseif ($this->selected instanceof Closure) {
                call_user_func_array($this->selected, [$this, $value, $label]);
                $attrs = $this->renderAttr($this->optionAttr);
                $this->optionAttr = null;
                return $attrs;
            } else {
                if ($this->selected == $value) {
                    $this->selected = null;

                    return 'selected="selected"';
                }
            }
        }
    }
protected function doSelect ( $ value , $ label ) { if ( $ this -> selected ) { if ( is_array ( $ this -> selected ) && count ( $ this -> selected ) > 0 ) { $ result = array_search ( $ value , $ this -> selected ) ; if ( $ result !== false ) { unset ( $ this -> selected [ $ result ] ) ; return 'selected="selected"' ; } } elseif ( $ this -> selected instanceof Closure ) { call_user_func_array ( $ this -> selected , [ $ this , $ value , $ label ] ) ; $ attrs = $ this -> renderAttr ( $ this -> optionAttr ) ; $ this -> optionAttr = null ; return $ attrs ; } else { if ( $ this -> selected == $ value ) { $ this -> selected = null ; return 'selected="selected"' ; } } } }
Set the as selected of items.

@param mixed $value

@return string
Set the as selected of items .