Hello.
I'm trying to make multipleSelect, pull out an abbushArray to string conversion
In the table for the field category didvarchar
I want to get data in the table in the form of 1,2
How to implement this?
$form->multipleSelect('category')->options([1 => 'one', 2 => 'two']);
You should define a accessor and a mutator for column category in your model to handle the string type
public function getCategoryAttribute($value)
{
return explode(',', $value);
}
public function setCategoryAttribute($value)
{
$this->attributes['category'] = implode(',', $value);
}
Many thanks
Most helpful comment
You should define a accessor and a mutator for column
categoryin your model to handle the string type