@php // Default values jika tidak ada heroes $defaultTitle = 'Solusi Mesin Teknologi Terdepan'; $defaultSubtitle = 'Untuk Semua Kebutuhan Bisnis & Industri Anda'; $defaultDescription = 'Menyediakan berbagai mesin berkualitas tinggi untuk meningkatkan produktivitas bisnis Anda'; // Gunakan data heroes yang sudah dikirim dari controller, atau ambil dari database jika tidak ada if (!isset($heroes)) { $heroes = \App\Models\Hero::where('is_active', true) ->orderBy('order') ->orderBy('created_at', 'desc') ->get(); } @endphp @if(isset($heroes) && $heroes->count() > 0)
@foreach($heroes as $index => $hero) @php $title = $hero->title ?? $defaultTitle; $subtitle = $hero->subtitle ?? $defaultSubtitle; $description = $hero->description ?? $defaultDescription; $imageUrl = asset('uploads/' . $hero->image); @endphp

{{ $title }}

{{ $subtitle }}

{{ $description }}

Lihat Produk
@endforeach
@if($heroes->count() > 1) @endif @if($heroes->count() > 1)
@foreach($heroes as $index => $hero) @endforeach
@endif
@else

{{ $defaultTitle }}

{{ $defaultSubtitle }}

{{ $defaultDescription }}

Lihat Produk
@endif