我正在尝试从 Excel 文件中检索结果以保存在数据库列中。这是我正在尝试的:
public function addRecords(Request $request){
$file = $request->get('file');
//echo $file;
Excel::load($file, function($reader){
$results = $reader->get()->toArray();
echo $results;
foreach($results as $key => $value){
$sim = new Sim();
$sim->msisdn = $value['msisdn'];
$sim->imei = $value['imei'];
$sim->issued_to = $value['issued_to'];
$sim->associated_with_employee = $value['associated_with_employee'];
$sim->save();
}
});
}
我收到错误:
未定义的索引:msisdn|imei|issued_to|associated_with_employee。
我在这里做错了什么?