@foreach ($products as $product)
@php
$hasOffer =
!is_null($product->offer_price) &&
$product->offer_price < $product->price &&
(is_null($product->offer_expiry_date) || $product->offer_expiry_date->isFuture());
$featureImage = $product->feature_image
? (\Illuminate\Support\Str::startsWith($product->feature_image, ['http://', 'https://'])
? $product->feature_image
: asset('storage/' . $product->feature_image))
: null;
$galleryImage = optional($product->images->first())->image_path;
$galleryImageUrl = $galleryImage
? (\Illuminate\Support\Str::startsWith($galleryImage, ['http://', 'https://'])
? $galleryImage
: asset('storage/' . $galleryImage))
: null;
$productImage =
$featureImage ?:
$galleryImageUrl ?:
'https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=600&q=80';
@endphp

@if ($hasOffer)
Sale
@endif
{{ $product->product_title }}
@if ($hasOffer)
{{ number_format((float) $product->offer_price, 0) }}৳
{{ number_format((float) $product->price, 0) }}৳
@else
{{ number_format((float) $product->price, 0) }}৳
@endif
@endforeach