How to insert embeded document use eloquent or query builder #2176
Unanswered
abdrozak20
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
i have request like this :
{
"title": "RA Persis 396 Bina Auladi",
"npsn": "20223807",
"address": "Jl. Radar Auri, Gang Swadaya IV RT",
"province_id": 1,
"city_id": 1,
"district_id": 1,
"sub_district_id": 1,
"gallery":[
{
"id":1,
"name":"Gallery1"
},
{
"id":2,
"name":"Gallery2"
}
]
}
and how i insert into one document.
i try like this :
$school = School::create([
"index"=>$index,
"title"=>$title,
"npsn"=>$npsn,
"address"=>$address,
"province_id"=>$province_id,
"city_id"=>$city_id,
"district_id"=>$district_id,
"sub_district_id"=>$sub_district_id,
"gallery"=>[
["id"=>1,"name"=>"gallery1"],
["id"=>2,"name"=>"gallery2"]
],
]);
success, but gallery not inserted.
any idea ? please help.
thanks in advice
Beta Was this translation helpful? Give feedback.
All reactions