Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to insert embeded document use eloquent or query builder #2176

Unanswered
abdrozak20 asked this question in Ideas
Discussion options

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

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /