Advertisement
NubeColectiva

Mostrar Imágen relacion hasOne Laravel 6.2

Apr 17th, 2020
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.03 KB | None | 0 0
  1. <!-- Tabla HTMl -->
  2. <table class="table table-striped table-bordered table-hover">
  3.     <thead>
  4.         <tr>
  5.             <th>Nombre</th>
  6.             <th>Precio</th>
  7.             <th>Stock</th>
  8.             <th>Imagen</th>
  9.             <th>Acciones</th>
  10.         </tr>
  11.     </thead>
  12.     <tbody>
  13.         @foreach($bicicletas as $bic)
  14.         <tr>
  15.             <td class="v-align-middle">{{$bic->nombre}}</td>
  16.             <td class="v-align-middle">{{$bic->precio}}</td>
  17.             <td class="v-align-middle">{{$bic->stock}}</td>
  18.             <td class="v-align-middle">
  19.                 <img src="../uploads/{{$bic->imagenesbicicletas()->first()->nombre}}" width="30" class="img-responsive">
  20.             </td>
  21.         </tr>
  22.         @endforeach
  23.     </tbody>
  24. </table>
  25.  
  26. <!-- Mostramos todas las imágenes pertenecientes a un registro (Página detalles) -->
  27. @foreach($imagenes as $img)
  28.  
  29. <a href="../../../uploads/{{ $img->nombre }}">
  30.     <img src="../../../uploads/{{ $img->nombre }}" width="200" class="img-fluid">
  31. </a>
  32. @endforeach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement