Where this error?? When the empty variable is full it works perfectly but when it is empty it does not show me the other part or the image or the link where the error could be?
@foreach($products as $product)
<div>
@foreach($product->fphoto as $produ)
@if(empty($produ->id))
<a href="{{ route('products.show', $product->id) }}">
<img src="{{asset('img/profile.jpg')}}" alt="">
@else
<a href="{{ route('products.show', $product->id) }}">
<img src="{{ $produ->photo }}" alt="">
@endif
@endforeach
<h3>{{ $product->nombreyape }}</h3></a>
<p>Textop>
</div>
@endforeach
If you want to control if the array comes full or not and send a message accordingly; you should do it through
forelse
EXAMPLE
right after
@empty
you send the message or the actions that you are going to carry out to indicate that the array is empty and that consequently the user does something