1
I got the following foreach
to pick up the id of the devices that were used in each sector:
@foreach($relatorio->Empresa->SetorEmpresa as $setor)
{{ $collection[] = $setor->SetorEmpresaEdificacao->id_aparelho_ruido }}
@endforeach
The problem is that when 2 sectors have been measured with the same device, I get that value 2 times. How do I make it not happen?
I’m getting it like this:
array:3 [▼
0 => 1
1 => 1
2 => 2
]
I need to receive like this, without repeating:
array:2 [▼
0 => 1
1 => 2
]
I even read about this unique array, but I couldn’t apply it. Applying this way doesn’t work, because I don’t pass the array there, but an integer.
– Raylan Soares
How is this array? Where is it being defined?
– Bruno
she is raised there msm in foreach. $Collection[] = ...
– Raylan Soares
got... put $Collection = array_unique($Collection) after foreach
– Raylan Soares
Good man, that’s it!
– Bruno