I want to create this response
'Points' => array(
'Point' => array(
array(
'Type' => 'value',
'Zone' => 'value
),
array(
'Type' => 'value',
'Zone' => 'value'
)
)
)
My code gives me this:
array:1 [▼
"Points" => array:1 [▼
"Point" => array:2 [▼
"Type" => 4
"Zone" => "Front"
]
]
]
Which is very close, unfortunately de Points key is being overwritten anyone knows what I am doing wrong?
$pointsObject = array();
foreach ($points as $point) {
$pointsObject['Points']['Point'] = array(
'Type' => $point->type,
'Zone' => $point->zone
);
}
dd($pointsObject);