-2

I want to have a condition where it can work when there is no image. Can someone help me?

@if ($product->gallery)
    <a href="{{ $product->gallery->first()->getUrl() }}" target="_blank">
        <img src="{{ $product->gallery->first()->getUrl() }}" width="45" height="45">
    </a>
@else
    <span class="badge badge-warning">No Image</span>
@endif
DapOne
  • 1
  • 1

0 Answers0