@extends('layouts.public') @section('content') @php /** * Modern single-post page (template-blend). Reuses the working logic of * blog-detail.php verbatim (comment render closure, comment flash extraction, * share url, comment form, prev/next nav, related posts) and swaps the chrome * for the .qm-blogm-* creative subheader + two-sidebar layout. * * @var array $post the post row (joined with category_name/slug, author_avatar) * @var array $related up to 3 related posts * @var array $comments threaded approved comments (parents w/ 'replies') * @var int $commentCount total approved comments * @var array|null $prevPost ['title','slug'] or null * @var array|null $nextPost ['title','slug'] or null * @var array $tags real per-post tags: [['label'=>..,'url'=>..], ..] * @var int $readMinutes estimated reading time in minutes * @var array $popularPosts 4 popular post rows (+ 'tags') for the left sidebar * @var array $tagCloud deduped [['label'=>..,'url'=>..], ..] for the left sidebar * @var array $categories {name, slug, post_count} for the left sidebar * @var array $featuredRestaurants restaurant rows for the left sidebar * @var array|null $featured most-viewed post for the right sidebar */ $tags = $tags ?? []; $readMinutes = (int) ($readMinutes ?? 1); /** Render one comment block; replies are indented by the caller. */ $renderComment = static function ($c): void { // array row or BlogComment model $when = !empty($c['created_at']) ? fmt_day($c['created_at']) : ''; @endphp
{!! brandmark_html($c['avatar'] ?? null, (string) ($c['name'] ?? t('vendor.reservations.guest_fallback')), 'md') !!}
{{ $c['name'] }} @if ($when !== '')@endif

{!! nl2br(e($c['body'])) !!}

@php }; // Consume the comment-specific flash here so it renders INLINE in the form card // (not in the global top-of-page banner). getFlashes() in the layout will then // not see these keys. $commentOk = \App\Support\Session::pullFlash('comment_ok'); $commentErr = \App\Support\Session::pullFlash('comment_err'); $shareUrl = url('/blog/' . $post['slug']); $activeCat = (string) ($post['category_slug'] ?? ''); $two = $twoSidebars ?? true; // admin: two sidebars (default) or one (right only) @endphp @partial('subheader', [ 'type' => 'post', 'title' => $post['title'], 'eyebrow' => t_raw('blog.eyebrow_from_kitchen'), 'crumbs' => [ ['label' => t_raw('common.home'), 'url' => route('home')], ['label' => t_raw('footer.blog'), 'url' => route('blog')], ['label' => str_excerpt((string) $post['title'], 6)], ], ])
@if ($two) @endif
{{ $post['title'] }}
@php // Title shown in the subheader h1; keep one visible title — the in-article heading is for assistive tech only. @endphp

{{ $post['title'] }}

@php // Author + date meta mirrors the archive card foot for one consistent look, plus the category badge. @endphp
{{ $post['body'] /* admin-authored, sanitized on save */ }}
@php $postTags = $tags; @endphp @if ($postTags)
@foreach ($postTags as $t) {{ $t['label'] }} @endforeach
@endif
{{ t_raw('blog.written_by_eyebrow') }}

{!! ($post['author_name'] ?? '') !== '' ? e($post['author_name']) : t('blog.admin_fallback_name') !!}

{{ t_raw('blog.author_bio_text', [':site' => setting('site_name', 'QuickMunch')]) }}

{{ t_raw((int) $commentCount === 1 ? 'blog.comment_count_one' : 'blog.comment_count_many', [':n' => (int) $commentCount]) }}

@if ($comments)
@foreach ($comments as $c) @php $renderComment($c); @endphp @if (!empty($c['replies']))
@foreach ($c['replies'] as $reply) @php $renderComment($reply); @endphp @endforeach
@endif @endforeach
@else

{{ t_raw('blog.no_comments_yet') }}

@endif

{{ t_raw('blog.leave_a_reply') }}

@if ($commentOk !== '')
{{ $commentOk }}
@elseif ($commentErr !== '') @endif
@csrf

{{ t_raw('blog.comment_privacy_note') }}

@if ($prevPost || $nextPost) @endif @if ($related)

{{ t_raw('blog.related_posts_title') }}

@foreach ($related as $r)

{{ $r['title'] }}

@if (!empty($r['excerpt']))

{{ str_excerpt((string) $r['excerpt'], 18) }}

@endif
{!! ($r['author_name'] ?? '') !== '' ? e($r['author_name']) : t('blog.admin_fallback_name') !!} @if (!empty($r['published_at'])) @endif {{ t_raw('blog.read_more') }}
@endforeach
@endif
@endsection