📜  在数据库 laravel 上混合数据 - PHP 代码示例

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

代码示例1
$data = $request->all();
$finalArray = array();
foreach($data as $key=>$value){
   array_push($finalArray, array(
                'fltno'=>$value['sflt'],
                'model'=>$value['smodel'],
                'engine'=>$value['sengine'],
                'loc'=>$value['sloc'],
                'serviceType'=>$value['sstye'],
                'nextSvr'=> $value['snsvr'] )
   );
});

Model::insert($finalArray);