@extends('layouts.site')
@section('content')
@php
// Admin verisi varsa ve boş değilse dinamik render, yoksa statik HTML
$pageData = $page->data ?? [];
$hasDynamic = is_array($pageData) && count($pageData) > 0;
@endphp
@if($hasDynamic)
{{-- Dinamik (admin) veri ile render --}}
{{ data_get($page->data ?? [], 'hero_title') }}
{{ data_get($page->data ?? [], 'hero_subtitle') }}
@if($img = data_get($page->data ?? [], 'hero_image'))
 }})
@endif
@if($features = data_get($page->data ?? [], 'features', []))
@foreach($features as $item)
@if(!empty($item['icon']))
 }})
@endif
{{ $item['title'] ?? '' }}
{{ $item['text'] ?? '' }}
@endforeach
@endif
@if(data_get($page->data ?? [], 'cta_title'))
@endif
@else
{{-- Statik fallback: public/html/index.html içeriğinin
bölümü --}}
@php
$indexPath = public_path('html/index.html');
$bodyHtml = '';
if (file_exists($indexPath) && is_readable($indexPath)) {
$html = file_get_contents($indexPath);
// Body içeriğini çıkar
if (preg_match('/]*>(.*?)<\/body>/is', $html, $m)) {
$bodyHtml = $m[1];
}
}
// Eğer body boşsa placeholder göster
if (empty(trim($bodyHtml))) {
$bodyHtml = 'Admin panelinden anasayfa içeriği ekleyin veya index.html kontrol edin.
';
}
@endphp
{!! $bodyHtml !!}
@endif
@endsection