Search code examples
laravellaravel-collection

foreach on a Laravel collection


I'm pretty confused, I need to make a loop from a Laravel collection to print it a table.

My collection looks like:

enter image description here

The loop that I'm trying to do is something like:

@foreach($entries as $key => $value)
    <tr>
        <td>{{ $value->nombre }}</td>
        <td>
            <a href="/rgl/resultados/archivoerrors/{{$file["type"]}}/{{$file["nombre"]}}" class="btn btn-primary mr-5"><i class="fa fa-fw fa-download" data-toggle="tooltip" data-placement="top" title="" data-original-title="Download"></i> </a>
        </td>
    </tr>
@endforeach

I'm having issues to read the collection on the loop, confused with the array-string-object concept. I need to read the 'nombre', 'path' and 'type'

Any help?


Solution

  • It's an array, so do this instead:

    {{ $value['nombre'] }}
    

    And:

    {{ $value['type'] . '/' . $value['nombre'] }}