I have the following structure:
{
"produto_id" : 54,
"descricao_id" : 25,
"contas" : [
{
"marketplace_id" : 8,
"contas_ids" : [
6, 8, 9
]
},
{
"marketplace_id" : 9,
"contas_ids" : [
44, 100
]
}
]
}
I want to get an array contained all the "contas_ids" like this:
[6, 8, 9, 44, 100]
I've tried array_map but I had to use so many. With array_column I achieve something close but it divided the output in several arrays.
$ids = array_column($contas, 'contas_ids');
using "dd" I get this.
array:2 [
0 => array:3 [
0 => 6
1 => 8
2 => 9
]
1 => array:2 [
0 => 44
1 => 100
]
]
Can someone help me produce a single array with all "contas_id"?