<label class=" ORGAD1-labeltext2">Color</label>
<select class="select-color-multiple col-sm-12 ORGAD16-color" multiple="multiple" name="color[]" id="color">
<option value="">choose color</option>
<option value="1" >Black</option>
<option value="2">White</option>
<option value="3">Green</option>
<option value="4">Red</option>
<option value="5">Blue</option>
</select>
In dropdown I select multiple values eg:2 (white) 4(red) 5(blue) passes to controller
$rules['color' => 'required']
$colors = $Request->color;
$choosecolors = implode(',', $colors);
[ dd(colors) if made dd means its shows "1,2,3"]
$store = modelcolor::insertcolors($choose)
In my model model color
public static function insertcolors($choose)
{
$createColor = new Colorstable;
$createColor->colorslist = $choose;
}
If store this value means its shows following error:
SQLSTATE[01000]: Warning: 1265 Data truncated for column 'colorslist' at row 1
here colorlist column is in int(11)
varcharinstead of anint. Int's cannot store commas or spaces, so it very likely that the example is only saving 1 because the data is truncated at the first comma for not being a number.