@include('components.head')
{{-- Include header and pass necessary data --}} @php $headerBlock = \App\Models\Block::where('type', 'header_block')->first(); @endphp @include('components.header', compact('headerBlock')) @if(isset($page)) {{-- If there is a view for this page --}} @includeIf('pages.top.'.$slug) @include('components.title', ['title' => $page->title]) {{-- Hero Section --}} @php $heroBlock = \App\Models\Block::where('type', 'hero_block')->first(); @endphp @if ($heroBlock) @include('blocks.hero_block', ['block' => $heroBlock]) @endif {{-- Card Container --}}
{{-- Include all linked blocks except footer blocks --}} @foreach ($page->blocks as $block) @if ($block->type == 'footer_block' || $block->type == 'hero_block') {{-- Skip footer block and hero block here to avoid duplication --}} @continue @endif @if ($block->type == 'card')
@include('blocks.'.$block->type, $block)
@else {{-- Based on the block type, include the appropriate blade file --}} @include('blocks.'.$block->type, $block) @endif @endforeach
{{-- If there is a view for this page --}} @includeIf('pages.bottom.'.$slug) {{-- Include footer and pass necessary data --}} @php $footerBlocks = $page->blocks->where('type', 'footer_block'); $pageItems = \App\Models\Page::footerMenu(false)->get(); @endphp @include('components.footer', compact('footerBlocks', 'pageItems')) @else

Page not found.

@endif