@extends('layouts.app') @section('title', $pageTitle ?? __('Home')) @section('meta_description', $pageDescription ?? '') @section('meta_keywords', $pageKeywords ?? '') @section('content') @php /* |-------------------------------------------------------------------------- | Homepage presentation helpers |-------------------------------------------------------------------------- */ $storageUrl = static function (?string $path): ?string { if (blank($path)) { return null; } $path = trim($path); if ( str_starts_with($path, 'http://') || str_starts_with($path, 'https://') ) { return $path; } if (str_starts_with($path, '/storage/')) { return asset(ltrim($path, '/')); } if (str_starts_with($path, 'storage/')) { return asset($path); } return asset('storage/' . ltrim($path, '/')); }; $safeLink = static function (?string $link): ?string { if (blank($link)) { return null; } $link = trim($link); if (str_starts_with($link, '/')) { return url($link); } if ( filter_var($link, FILTER_VALIDATE_URL) !== false && in_array( strtolower((string) parse_url($link, PHP_URL_SCHEME)), ['http', 'https'], true ) ) { return $link; } return null; }; $productTitle = static function ($product): string { return trim( (string) ( $product->details->first()?->title ?? $product->slug ?? __('Product') ) ); }; $productImage = static function ($product) use ($storageUrl): ?string { $image = $product->images->firstWhere('is_main', true) ?? $product->images->first(); return $storageUrl( $image?->image_small ?? $image?->image_default ); }; $effectivePrice = static function ($product): float { $regularPrice = (float) $product->price; $discountedPrice = (float) $product->price_discounted; return $discountedPrice > 0 && $discountedPrice < $regularPrice ? $discountedPrice : $regularPrice; }; $productSections = [ [ 'key' => 'special-offers', 'title' => __('Special Offers'), 'description' => __('Limited-time marketplace deals selected for you.'), 'icon' => 'fa-bolt', 'icon_class' => 'text-danger', 'products' => $specialOffers ?? collect(), ], [ 'key' => 'promoted-products', 'title' => __('Featured Products'), 'description' => __('Discover products highlighted by trusted marketplace sellers.'), 'icon' => 'fa-fire', 'icon_class' => 'text-warning', 'products' => $promotedProducts ?? collect(), ], [ 'key' => 'latest-products', 'title' => __('Latest Products'), 'description' => __('Explore the newest products and digital solutions on WebMarket.'), 'icon' => 'fa-clock', 'icon_class' => 'text-primary', 'products' => $latestProducts ?? collect(), ], ]; $applicationName = $generalSettings->application_name ?? config('app.name', 'WebMarket'); $sliderItems = $sliderItems ?? collect(); $featuredCategories = $featuredCategories ?? collect(); $indexCategories = $indexCategories ?? collect(); $homepageBanners = $homepageBanners ?? collect(); $brands = $brands ?? collect(); $blogPosts = $blogPosts ?? collect(); $statistics = $marketplaceStatistics ?? [ 'products' => 0, 'sellers' => 0, 'categories' => 0, ]; /* * Currency selected under Admin > Settings > Payments. */ $storefrontCurrency = default_currency(); @endphp {{-- Hero section --}}
@if($sliderItems->isNotEmpty()) @else
{{ __('Professional Digital Marketplace') }}

{{ __('Build, buy and grow your digital business.') }}

{{ $pageDescription ?: __('Discover professional websites, digital products and business services from trusted sellers.') }}

{{ __('Browse Products') }} @auth @if(auth()->user()->isSeller() && Route::has('seller.dashboard')) {{ __('Seller Dashboard') }} @elseif(Route::has('seller.apply')) {{ __('Start Selling') }} @endif @else @if(Route::has('register')) {{ __('Join WebMarket') }} @endif @endauth

{{ __('Everything your business needs') }}

{{ __('Ready-made professional websites') }}
{{ __('Secure digital product delivery') }}
{{ __('Experienced marketplace sellers') }}
{{ __('Business support and customization') }}
@endif
{{-- Marketplace search --}}
{{-- Marketplace statistics --}} @if(array_sum(array_map('intval', $statistics)) > 0)
{{ number_format((int) ($statistics['products'] ?? 0)) }}
{{ __('Published Products') }}
{{ number_format((int) ($statistics['sellers'] ?? 0)) }}
{{ __('Trusted Sellers') }}
{{ number_format((int) ($statistics['categories'] ?? 0)) }}
{{ __('Categories') }}
{{ __('Secure') }}
{{ __('Protected Checkout') }}
@endif {{-- Featured categories --}} @if($featuredCategories->isNotEmpty())
{{ __('Browse Marketplace') }}

{{ __('Featured Categories') }}

{{ __('Find the right product or service for your next project.') }}

{{ __('View All Products') }}
@foreach($featuredCategories as $category) @php $categoryName = $category->translations->first()?->name ?? $category->slug ?? __('Category'); $categoryImage = $storageUrl($category->image); @endphp @endforeach
@endif {{-- Homepage banners --}} @if($homepageBanners->isNotEmpty())
@foreach($homepageBanners as $location => $banners)
@foreach($banners as $banner) @php $bannerImage = $storageUrl($banner->banner_image_path); $bannerLink = $safeLink($banner->banner_url); $columnClass = $banners->count() === 1 ? 'col-12' : ($banners->count() === 2 ? 'col-md-6' : 'col-md-6 col-lg-4'); @endphp @if($bannerImage)
@if($bannerLink) {{ __('Marketplace promotion') }} @else
{{ __('Marketplace promotion') }}
@endif
@endif @endforeach
@endforeach
@endif {{-- Product sections --}} @foreach($productSections as $section) @if($section['products']->isNotEmpty())
{{ __('Marketplace Collection') }}

{{ $section['title'] }}

{{ $section['description'] }}

{{ __('Explore All') }}
@foreach($section['products'] as $product) @php $title = $productTitle($product); $image = $productImage($product); $sellingPrice = $effectivePrice($product); $regularPrice = (float) $product->price; $productCurrency = $storefrontCurrency; $hasDiscount = (float) $product->price_discounted > 0 && (float) $product->price_discounted < $regularPrice; $categoryName = $product->category?->translations?->first()?->name ?? __('Uncategorized'); @endphp
@if($image) {{ $title }} @else
@endif
@if( $product->is_promoted && $product->promote_end_date?->isFuture() ) {{ __('Featured') }} @endif @if($product->is_special_offer) {{ __('Special Offer') }} @endif
{{ \Illuminate\Support\Str::headline($product->product_type) }}
{{ $categoryName }}

{{ $title }}

@if(filled($product->details->first()?->short_description))

{{ \Illuminate\Support\Str::limit( strip_tags($product->details->first()->short_description), 95 ) }}

@endif
{{ money( $sellingPrice, $productCurrency ) }} @if($hasDiscount) {{ money( $regularPrice, $productCurrency ) }} @endif
{{ number_format( (float) $product->rating, 1 ) }} ({{ number_format( (int) ( $product->reviews_count ?? 0 ) ) }})
{{ __('View Product') }} @if($product->seller && Route::has('sellers.show')) @endif
@endforeach
@endif @endforeach {{-- Marketplace categories --}} @if($indexCategories->isNotEmpty())
{{ __('Explore More') }}

{{ __('Marketplace Categories') }}

@foreach($indexCategories as $category) @php $categoryName = $category->translations->first()?->name ?? $category->slug ?? __('Category'); @endphp @endforeach
@endif {{-- Why choose WebMarket --}}
{{ __('Shop With Confidence') }}

{{ __('Why choose :name?', ['name' => $applicationName]) }}

{{ __('A professional marketplace built for secure purchases, reliable sellers and growing businesses.') }}

{{ __('Secure Payments') }}

{{ __('Protected checkout with trusted payment providers and transaction verification.') }}

{{ __('Trusted Sellers') }}

{{ __('Purchase professional products and services from marketplace sellers.') }}

{{ __('Digital Delivery') }}

{{ __('Access eligible digital purchases and licence information from your account.') }}

{{ __('Dedicated Support') }}

{{ __('Open support tickets and communicate securely through your customer account.') }}

{{-- Brands --}} @if($brands->isNotEmpty())
{{ __('Marketplace Partners') }}

{{ __('Brands on WebMarket') }}

@foreach($brands as $brand) @php $brandImage = $storageUrl($brand->image_path); @endphp
@if($brandImage) {{ $brand->name ?: __('Brand') }} @else {{ $brand->name ?: __('Brand') }} @endif
@endforeach
@endif {{-- Blog --}} @if($blogPosts->isNotEmpty())
{{ __('Resources and Insights') }}

{{ __('From Our Blog') }}

{{ __('Marketplace news, business guidance and digital growth insights.') }}

{{ __('Visit Blog') }}
@foreach($blogPosts->take(4) as $post) @php $postImage = $storageUrl( $post->image_small ?? $post->image_default ); @endphp
@endforeach
@endif {{-- Final call to action --}}
{{ __('Grow with WebMarket') }}

{{ __('Ready to move your digital business forward?') }}

{{ __('Find professional products, launch your next website or connect with marketplace sellers today.') }}

{{ __('Explore Marketplace') }} @guest @if(Route::has('register')) {{ __('Create Free Account') }} @endif @else @if(Route::has('account.dashboard')) {{ __('My Account') }} @endif @endguest
{{-- Structured website data --}} @php $structuredData = [ '@context' => 'https://schema.org', '@type' => 'WebSite', 'name' => $applicationName, 'url' => route('home'), 'description' => $pageDescription, 'potentialAction' => [ '@type' => 'SearchAction', 'target' => route('storefront.products.index') . '?q={search_term_string}', 'query-input' => 'required name=search_term_string', ], ]; @endphp @endsection @push('styles') @endpush