If you do a first() instead of a get() you get only one record. On that way $indirizzo will be the object you want or null. So you don't need to do $indirizzo[0];
$indirizzo = DB::table('indirizzoimpiantos')
->where('id_impianto', $dettagliimpianto[0]->id)
->first();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community