@extends('layouts.public') @section('content') @php /** * @var array $post the post row (joined with category_name/slug) * @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 */ $tags = $tags ?? []; $readMinutes = (int) ($readMinutes ?? 1); $tagCloud = $tagCloud ?? []; $featuredRestaurants = $featuredRestaurants ?? []; $two = $twoSidebars ?? true; // admin: two sidebars (default) or one (right only) /** Render one comment block; $isReply indents it under its parent. */ $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']); @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)
@partial('blog-sidebar', ['active' => (string) ($post['category_slug'] ?? ''), 'tagCloud' => $tagCloud, 'featuredRestaurants' => $featuredRestaurants, 'widgets' => ['popular', 'tags', 'categories', 'restaurants']])
@endif
{{ $post['title'] }} @php // Meta vocabulary matches the archive card (author + date), with the category pill, for one consistent look. @endphp @php // Classic meta: category pill + author + date icons (matches the classic archive card). @endphp
{{ $post['body'] /* admin-authored, sanitized on save */ }}
@if ($tags)
@foreach ($tags 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
@partial('blog-sidebar', ['active' => (string) ($post['category_slug'] ?? ''), 'tagCloud' => $tagCloud, 'featuredRestaurants' => $featuredRestaurants, 'widgets' => $two ? ['search', 'recent', 'newsletter'] : ['search', 'categories', 'tags', 'recent', 'popular', 'restaurants', 'newsletter']])
@if ($related)

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

@foreach ($related as $r)
@endforeach
@endif
@endsection