@extends('frontend.main_master') @section('content') @php $layoutConfig = is_array($page->layout_config ?? null) ? $page->layout_config : null; $builderHero = is_array($layoutConfig['hero'] ?? null) ? $layoutConfig['hero'] : []; $builderSections = is_array($layoutConfig['sections'] ?? null) ? $layoutConfig['sections'] : []; $hasElementsSection = false; $hasZodiacSection = false; foreach ($builderSections as $builderSection) { if (($builderSection['type'] ?? null) === 'elements') { $hasElementsSection = true; } if (($builderSection['type'] ?? null) === 'zodiac') { $hasZodiacSection = true; } } $useBirthChartVisuals = in_array((string) ($page->template_key ?? ''), ['birth_chart_article', 'birth_chart_guide'], true) || $hasElementsSection || $hasZodiacSection; $heroTitle = trim((string) ($builderHero['title'] ?? '')) !== '' ? $builderHero['title'] : ($page->title ?? 'Sayfa'); $heroSubtitle = trim((string) ($builderHero['subtitle'] ?? '')) !== '' ? $builderHero['subtitle'] : ($page->subtitle ?? null); $sanitizeHex = static function ($value, $default) { $value = trim((string) $value); return preg_match('/^#[0-9a-fA-F]{6}$/', $value) ? strtolower($value) : $default; }; $heroTitleColor = $sanitizeHex($builderHero['title_color'] ?? '#ffffff', '#ffffff'); $heroSubtitleColor = $sanitizeHex($builderHero['subtitle_color'] ?? '#ffffff', '#ffffff'); $heroButtons = []; if (is_array($builderHero['buttons'] ?? null)) { foreach ($builderHero['buttons'] as $button) { if (!is_array($button)) { continue; } $text = trim((string) ($button['text'] ?? '')); $url = trim((string) ($button['url'] ?? '')); if ($text === '' || $url === '') { continue; } $heroButtons[] = [ 'text' => $text, 'url' => $url, 'bg_color' => $sanitizeHex($button['bg_color'] ?? '#ffffff', '#ffffff'), 'text_color' => $sanitizeHex($button['text_color'] ?? '#1f2937', '#1f2937'), ]; } } // Geriye dönük uyumluluk: eski tek buton alanını yeni listeye çevir. if (empty($heroButtons)) { $legacyButtonText = trim((string) ($builderHero['button_text'] ?? '')); $legacyButtonUrl = trim((string) ($builderHero['button_url'] ?? '')); if ($legacyButtonText !== '' && $legacyButtonUrl !== '') { $heroButtons[] = [ 'text' => $legacyButtonText, 'url' => $legacyButtonUrl, 'bg_color' => '#ffffff', 'text_color' => '#1f2937', ]; } } $heroBackgroundType = $builderHero['background_type'] ?? 'image'; $heroBackgroundColor = $builderHero['background_color'] ?? '#1f2937'; $heroGradientFrom = $builderHero['gradient_from'] ?? '#1f2937'; $heroGradientTo = $builderHero['gradient_to'] ?? '#7c3aed'; if ($heroBackgroundType === 'solid') { $heroStyle = 'background: ' . $heroBackgroundColor . ';'; } elseif ($heroBackgroundType === 'gradient') { $heroStyle = 'background: linear-gradient(135deg, ' . $heroGradientFrom . ', ' . $heroGradientTo . ');'; } else { $heroImagePath = $page->hero_image ? asset($page->hero_image) : asset('frontend/images/default-hero.jpg'); $heroStyle = 'background-image: url(' . $heroImagePath . ');'; } @endphp @push('styles') @if($useBirthChartVisuals) @endif @endpush
@push('schema') @if(isset($page)) @php $schemaBreadcrumbItems = [ ['name' => __('messages.nav_home'), 'url' => route('index')], ]; if (isset($page->parent) && $page->parent) { $schemaBreadcrumbItems[] = [ 'name' => $page->parent->title, 'url' => route('page.show', $page->parent->slug), ]; } $schemaBreadcrumbItems[] = [ 'name' => $page->title, 'url' => url()->current(), ]; @endphp @endif @endpush

{{ $heroTitle }}

@if($heroSubtitle)

{{ $heroSubtitle }}

@endif @if(!empty($heroButtons))
@foreach($heroButtons as $heroButton) @php $heroButtonClass = $loop->first ? 'hero-btn-primary' : 'hero-btn-secondary'; @endphp {{ $heroButton['text'] }} @endforeach
@endif
@if(!empty($builderSections)) @foreach($builderSections as $section) @if(($section['type'] ?? null) === 'text_part') @php $partBgType = $section['background_type'] ?? 'none'; $partStyle = ''; if ($partBgType === 'solid') { $partStyle = 'background:' . ($section['background_color'] ?? '#ffffff') . ';'; } elseif ($partBgType === 'gradient') { $partStyle = 'background: linear-gradient(135deg, ' . ($section['gradient_from'] ?? '#f8fafc') . ', ' . ($section['gradient_to'] ?? '#eef2ff') . ');'; } @endphp
@if(!empty($section['heading']))

{{ $section['heading'] }}

@endif @if(!empty($section['text']))

{!! nl2br(e($section['text'])) !!}

@endif
@elseif(($section['type'] ?? null) === 'elements') @include('frontend.pages.partials.elements-section') @elseif(($section['type'] ?? null) === 'zodiac') @include('frontend.pages.partials.zodiac-section') @endif @endforeach @else
{!! $page->content !!}
@endif @if(isset($page->images) && $page->images->count() > 0) @endif @if(isset($relatedPages) && $relatedPages->count() > 0) @endif
@if(!$useBirthChartVisuals)
@endif
@if($hasZodiacSection) @endif @endsection