Adding the multiple attribute on the category <select> doesn't re-evaluate the selected values and thus only reders one <option> as selected.
Setting the value again after the attribute was added triggers applyValueToOptions and renders multiple selected <option>s.
An alternative fix would be the following:
public function tags(string $type): Select
{
$this->ensureModelIsAvailable();
return $this->multiselect(
"{$type}_tags[]",
Tag::getWithType($type)->pluck('name', 'name'),
$this->model->tagsWithType($type)->pluck('name', 'name')
)
->attribute('data-select', 'tags');
}
Adding the
multiple
attribute on the category<select>
doesn't re-evaluate the selected values and thus only reders one<option>
as selected. Setting the value again after the attribute was added triggersapplyValueToOptions
and renders multiple selected<option>
s.An alternative fix would be the following: