Good afternoon I have been working with Laravel 5.6 and I have a problem reading an array that passed from the controller to the view, the array that passes from the controller arrives in the following way:
array:5 [▼
0 => {#357 ▼
+"serie": "AB-138"
+"numero": "2529150"
+"fecha": "08/11/2016"
+"codigo": "3810056"
+"descripcion": "BICILETA DE CARRERA"
+"costo": 2000
}
1 => {#358 ▼
+"serie": "AB193"
+"numero": "2632668"
+"fecha": "02/08/2017"
+"codigo": "3804056"
+"descripcion": "OSITO DE PELUCHE"
+"costo": 50
}
2 => {#359 ▼
+"serie": "AB199"
+"numero": "263775"
+"fecha": "02/09/2017"
+"codigo": "380635"
+"descripcion": "GUANTES DE GOMA"
+"costo": 5
}
]
But when trying to go through it and present it to the view with the following code
<tbody id='detallecompra'>
@php ($total = 0)
@endphp
@foreach ($productos as $producto)
<tr>
<td>{{ $producto->serie }}</td>
<td>{{ $producto->numero }}</td>
<td>{{ $producto->fecha }}</td>
<td>{{ $producto->codigo}}</td>
<td>{{ $producto->descripcion }}</td>
<td>{{ $producto->costo}}</td>
<tr>
@php ($total+=$producto->costo)
@endphp
@endforeach
<tr class="table-info">
<td colspan="5">Total</td>
<td class="text-right">{{ $total }}</td>
</tr>
</tbody>
Laravel answers me with the following error
Undefined property: stdClass::$serie
Someone could help me how to go through the array very grateful in advance