这是save()
函数中的代码:
for($i=0; $i<= count($input['quantity_ordered']); $i++) {
if(empty($input['quantity_ordered'][$i]) || !is_numeric($input['quantity_ordered'][$i])) continue;
$data = [
'order_no' => $input['order_no'][$i],
'quantity_ordered' => intval($input['quantity_ordered'][$i])
];
purch_order_verify_details::insert($data);
}
这是 VIEW :
@foreach($invoiceData as $k=>$result)
<tr class="tbl_header_color dynamicRows">
<input type="hidden" name="purchase_detail_id[]" value="{{$result->po_detail_item}}" />
<td width="10%" class="text-center"><input type="hidden" name="item_code[]" value="{{$result->item_code}}">{{$result->item_code}}</td>
<td width="30%" class="text-center hidden-sm hidden-xs"><input type="hidden" name="description[]" value="{{$result->description}}">{{$result->description}}</td>
<td width="10%" class="text-center"><input type="hidden" name="quantity_ordered[]" value="{{$result->quantity_ordered}}">{{$result->quantity_ordered}}</td>
<td><input class="form-control text-center no_units" stock-id="{{$result->quantity_ordered}}" min="0" data-id="{{$result->quantity_ordered}}" id="qty_{{$result->quantity_ordered}}" name="item_quantity[]" value="{{$result->quantity_ordered}}" data-tax="{{$result->quantity_ordered}}" type="text"><input name="item_id[]" value="{{$result->quantity_ordered}}" type="hidden"></td>
</tr>
@endforeach
答案 0 :(得分:0)
我认为您的if语句缺少花括号
for($i=0; $i<= count($input['quantity_ordered']); $i++) {
if (empty($input['quantity_ordered'][$i]) || !is_numeric($input['quantity_ordered'][$i])) {
$data = [
'order_no' => $input['order_no'][$i],
'quantity_ordered' => intval($input['quantity_ordered'][$i])
];
purch_order_verify_details::insert($data);
}
}