0
Does not accept the foreach?
{ $ssparray = array(
//Array numérico sendo a segunda dimensão.
'mensagem' => array(
'mensagem' => 'OK - preventiva realizada',
'usuario_api' => 'userapi',
'relatorio_fotografico' => 'rf',
'data_de_execucao_inicio' => $inicio,
'data_de_execucao' => $fim,
'preventiva_id' => $ordemservico->codigocliente,
),
/*
//Array Associativo sendo a segunda dimensão.
foreach ($fotos as $foto) {
'checklist' => array(
'id[i]' => $foto->checklistitens_id,
'nome' => $foto->checklistitens->descricao,
'valor' => $foto->situacao,
)
}
*/
}
This part of your code is incomplete and you can’t even analyze the problem. You are creating an array within another array already having its construction with a foreach. And I’m not sure, but I don’t think it works.
– Glenys Mitchell
Yes, this is the problem. I’m not sure how to do it! A foreach inside an array does not work. I put it there to give you an idea of what I need but I’ll rephrase it. Thank you.
– Marcos Birro
I’m going to make a structure a code the right way to do it, but I don’t know if it will suit you, because there are still snippets of your code.
– Glenys Mitchell
Inside this sspaarray can have as many checklists?
– Glenys Mitchell
Inside Checklist today has 28 items but I get from a table that can increase or decrease. Thanks. It cleared the way you did and yes, I’m studying right now how to do.
– Marcos Birro
Now I understand [$i] what you put, I will make the adaptation.
– Glenys Mitchell
If I put the return of Eloquent I can help with the code, with this code I only see pure PHP
– PaulinhoCaP