📜  Laravel 从表单中插入多行 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:47.681000             🧑  作者: Mango

代码示例2
foreach($request->input('pr_item') as $key => $value) {

            $Record=new PurchaseRequestItemModel;

            $Record->pr_form_number = $request->get('pr_number')[$key];
            $Record->item_no = $request->get('pr_item')[$key];
            $Record->pr_qty = $request->get('pr_qty')[$key];
            $Record->pr_unit = $request->get('pr_unit')[$key];
            $Record->pr_description =$request->get('pr_desc')[$key]; 
            $Record->pr_cost_per_unit =$request->get('pr_cpu')[$key];
            $Record->pr_estimated_cost =$request->get('pr_cpi')[$key];

            $Record->save();
        }