helpme, don´t work
//EXTRAIGO LOS DATOS DE ESTA TABLA
$perdidasyganancias = Perdidas_Ganancias::orderBy(‘cod_cuenta’,’asc’)->pluck(‘cod_cuenta’);
/*
ME RETORNA LOS CODIGOS QUE NECESITO
Collection {#1101 ▼
#items: array:6 [▼
0 => “1”
1 => “2”
2 => “4.1”
3 => “5.2”
4 => “5.2.1”
5 => “5.2.4”
]
}
*/
//DECLARO LA VARIABLE DONDE ALMACENAR´´É LOS RESULTADOS DE LA SEGUNDA CONSULTA
$resultados = [];
foreach ($perdidasyganancias as $codigo => $key) {
$resultados[$key] = Agrupacion_sumada::where(‘cod_cuenta’,$key)->where(‘periodo’,$year)->get();
}
dd($resultados);
me trae solo un array de la primera pocision
Question and answer is powered by AnsPress.io