a silly question but that is complicating me, how to avoid repeating the empty message, in the following code?
@foreach($contactos as $contacto)
@forelse($contacto->contactos as $valor)
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead class="bg-white">
<tr>
<th scope="col">N°</th>
<th scope="col">Nombre</th>
<th scope="col">Teléfono</th>
<th scope="col">Correo</th>
<th scope="col">Mensaje</th>
<th scope="col">Propiedad</th>
<th scope="col">Tiempo</th>
</tr>
</thead>
<?php $counter=1;?>
<tbody>
<tr>
<th scope="row"> <small> <?php echo $counter;?> </small></th>
<td> <small> {{ $valor->nombre }} </small></td>
<td> <small> {{ $valor->telefono }} </small></td>
<td> <small> {{ $valor->email }} </small></td>
<td class="text-justify"> <small> {{ $valor->mensaje }} </small></td>
<td> <a href="{{ url('detalle-propiedad/'.$contacto->slug_propiedad) }}" class="badge badge-primary">Ver propiedad</a> </td>
<td style="width: 12% !important"> <small>
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-clock" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm8-7A8 8 0 1 1 0 8a8 8 0 0 1 16 0z"/>
<path fill-rule="evenodd" d="M7.5 3a.5.5 0 0 1 .5.5v5.21l3.248 1.856a.5.5 0 0 1-.496.868l-3.5-2A.5.5 0 0 1 7 9V3.5a.5.5 0 0 1 .5-.5z"/>
</svg>
{{ $valor->created_at->diffForHumans() }} </small>
</td>
</tr>
</tbody>
<?php $counter++;?>
</table>
</div>
@empty
<p class="py-3 text-center">¡Aún no recibió contactos! </p>
@endforelse
@endforeach
The EMPTY always worked very well for me, but in this case, as I have nested the foreach, it shows me the EMPTY several times . I understand the problem, how would you solve it or handle it so that the message does not repeat itself?
Thank you very much for your time devoted to my consultation.
For now I found that it can be @break .
Is there another way? I find it a bit rustic.