我正在使用Laravel和mongodb(Jenssegers),我有如下的数组数据,
$insert[] = ['sub_id'=>$loggedin,
'userid' => $row->userid,
'username' => $row->username,
'email' => $row->email,
'mobileno' => $row->mobileno,
'manager_mail' => $row->manager_mail,
'roleid' => $userrole->roleid];
我的插入查询是,
$user->save($insert);
但它没有用,请建议任何解决方案?
答案 0 :(得分:0)
您需要使用modelBuilder.Entity<GICSSector>().ToTable("GICSSectors");
或create()
方法:
insert()
或者:
User::create($insert);
或者:
User::insert($insert);
答案 1 :(得分:0)
Eloquent save方法接受2D
数组。但是你提供了 $insert = ['sub_id'=>$loggedin,
'userid' => $row->userid,
'username' => $row->username,
'email' => $row->email,
'mobileno' => $row->mobileno,
'manager_mail' => $row->manager_mail,
'roleid' => $userrole->roleid];
$user->save($insert);
。请尝试以下代码:
{{1}}