我尝试这样做时出现此错误:
[{
"id": "1",
"item_request_id": "1",
"nama_detail": "Create Login Novell"
}, {
"id": "2",
"item_request_id": "1",
"nama_detail": "Create Email Baru"
}, {
"id": "3",
"item_request_id": "1",
"nama_detail": "Disable / Hapus Login Novell"
}, {
"id": "4",
"item_request_id": "1",
"nama_detail": "Disable / Hapus Email"
}]
$ additional_features是一个数组,我尝试添加它,所以我在数组中有多少项目我将有那么多记录。任何建议?
答案 0 :(得分:3)
使用正确的语法:
$additional = Feature::firstOrCreate($data);
或者:
$additional = new Feature;
$additional->firstOrCreate($data);