请帮助我, 我在Laravel项目上遇到问题。我想要“ foreach”作为“项目详细信息”。
'item_details' => [
[
'id' => 'REQ00'.$pesanan->id,
'price' => $standar_price,
'quantity' => 1,
'name' => 'Product Name'
],
foreach($extras as $extra){
[
'id' => 'EXT'.$extra->id,
'price' => ExtraCategory::where('id',$extra->extra_code)->first()->price,
'quantity' => 1,
'name' => ExtraCategory::where('id',$extra->extra_code)->first()->title
]
}
]