{{-- @if ($ad->image_type == 'one') --}} {{-- @php dd($ad->products) @endphp --}}

Single Product

Select Product Image Title Old Price New Price
@if ($ad->products->isNotEmpty() && ($img = $ad->products->first()->getFirstMedia('quadrant_ad_product'))) @endif
{{-- @endif @if ($ad->image_type == 'four') --}}

Four Products

@php // Convert products to fixed 4 rows $rows = []; for ($i = 0; $i < 4; $i++) { $rows[$i] = $ad->products[$i] ?? null; } @endphp @foreach ($rows as $key => $p) @endforeach
Select Product Image Title Old Price New Price
@if ($p && ($img = $p->getFirstMedia('quadrant_ad_product'))) @endif
{{-- @endif --}}

Three Products

@php // Convert products to fixed 4 rows $rows = []; for ($i = 0; $i < 3; $i++) { $rows[$i] = $ad->products[$i] ?? null; } @endphp @foreach ($rows as $key => $p) @endforeach
Select Product Image Title Old Price New Price
@if ($p && ($img = $p->getFirstMedia('quadrant_ad_product'))) @endif

Two Products

@php // Convert products to fixed 4 rows $rows = []; for ($i = 0; $i < 2; $i++) { $rows[$i] = $ad->products[$i] ?? null; } @endphp @foreach ($rows as $key => $p) @endforeach
Select Product Image Title Old Price New Price
@if ($p && ($img = $p->getFirstMedia('quadrant_ad_product'))) @endif