@php use Illuminate\Support\Str; $fallbackImage = 'https://images.unsplash.com/photo-1552820728-8b83bb6b773f?q=70&w=1400&auto=format&fit=crop'; $imageFor = fn ($game) => $game?->thumbnail_url ?: $fallbackImage; $discountFor = fn ($game) => (int) ($game?->detail?->discount ?? 0); $finalPriceFor = fn ($game) => max(0, (float) ($game?->price ?? 0) * (1 - ($discountFor($game) / 100))); $formatPrice = fn ($price) => (float) $price <= 0 ? 'Gratis' : 'Rp ' . number_format($price, 0, ',', '.'); $descriptionFor = fn ($game, $limit = 130) => Str::limit($game?->detail?->short_description ?: $game?->description ?: 'Temukan dunia baru, tantangan seru, dan pengalaman bermain pilihan di PlayMart.', $limit); $releaseDateFor = fn ($game) => $game?->release_date ? $game->release_date->translatedFormat('j M Y') : 'Tanggal belum tersedia'; $cartCount = auth()->check() ? auth()->user()->carts()->count() : 0; $leadRecommended = $recommendedGames->first(); $sideRecommended = $recommendedGames->skip(1)->take(4); @endphp @extends('layouts.store') @push('styles') @endpush @section('content')
@if($featuredGames->isNotEmpty())
@foreach($featuredGames as $slideIndex => $heroGame) @php $featuredDiscount = $discountFor($heroGame); $featuredFinal = $finalPriceFor($heroGame); @endphp
{{ $heroGame->title }}
Featured

{{ $heroGame->title }}

{{ $heroGame->genres->take(3)->pluck('name')->join(' / ') ?: 'Explore. Play. Collect.' }}

@if($featuredDiscount > 0) -{{ $featuredDiscount }}% {{ $formatPrice($heroGame->price) }} @endif {{ $formatPrice($featuredFinal) }} View Game
@endforeach @if($featuredGames->count() > 1)
@foreach($featuredGames as $slideIndex => $heroGame) @endforeach
@endif
@else
Featured

PlayMart

Tambahkan data game lewat admin supaya halaman store bisa menampilkan hero dan rekomendasi.

@endif
@if($showcaseTabs->isNotEmpty())
@foreach($showcaseTabs as $tabIndex => $tab) @endforeach
@foreach($showcaseTabs as $tabIndex => $tab)
@foreach($tab['games'] as $gameIndex => $game) @php $discount = $discountFor($game); $finalPrice = $finalPriceFor($game); $rowTags = $game->genres ->take(3) ->pluck('name') ->merge($game->categories->take(1)->pluck('name')) ->filter() ->values(); @endphp {{ $game->title }} {{ $game->title }} {{ $rowTags->isNotEmpty() ? $rowTags->join(', ') : 'PlayMart' }} Dirilis: {{ $releaseDateFor($game) }} {{ $formatPrice($finalPrice) }} @endforeach
@endforeach
@endif @if($browseCategoryCards->isNotEmpty())

Telusuri Berdasarkan Kategori

@endif @if($budgetDeals->isNotEmpty())

Di Bawah Rp 90.000

Lebih banyak lagi: @foreach($budgetQuickLinks as $quickLink) {{ $quickLink['label'] }} @endforeach
@foreach($budgetDeals as $game) @php $discount = $discountFor($game); $finalPrice = $finalPriceFor($game); @endphp {{ $game->title }}

{{ $game->title }}

@if($discount > 0) -{{ $discount }}% {{ $formatPrice($game->price) }} @endif {{ $formatPrice($finalPrice) }}
@endforeach
@endif
@endsection @push('scripts') @endpush