How to save multiple checkbox value into database? now the value is storing in different rows. example: i selected value 1 and 2.so the value 1 in 1 row and value 2 in another row.
blade
<form enctype="multipart/form-data" action="/report/{{$postqs->id}}"
method="POST">
<input type="checkbox" name="item[]" value="one" />1
<input type="checkbox" name="item[]" value="two" />2
<input type="checkbox" name="item[]" value="three" />3
<div class="row">
<div class="form-group">
<label class="control-label col-sm-2"> Others:</label>
<div class="col-sm-7">
<textarea name="report" id="report" class="form-control"></textarea>
</div>
</div>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="submit" class="pull-right btn btn-sm btn-primary">
</div></div></div>
</form>
Report model
protected $fillable = ['report','postqs_id','user_id','item'];
Store controller :
public function store(Request $request,Postqs $postqs,$id,Report $report,
Admin_report $admin_report)
{
foreach ($request->input("item") as $key=>$value){
$add_item = new Report;
$add_item->item= $value;
$add_item->user_id= Auth::user()->id;
$add_item->postqs_id=$id;
$add_item->save();
return back();
}