@extends('frontend.layout') @section('title', $blog->title) @section('content') @php // Parse tags from comma-separated string to array $tags = !empty($blog->tags) ? array_map('trim', explode(',', $blog->tags)) : []; // Get FAQ data - handle different formats $faqs = []; if (!empty($blog->faq_json)) { if (is_array($blog->faq_json)) { $faqs = $blog->faq_json; } else { $decoded = json_decode($blog->faq_json, true); $faqs = is_array($decoded) ? $decoded : []; } } // Convert FAQ array to simple format if it's in "new_1", "new_2" format if (!empty($faqs) && isset($faqs['new_1'])) { $faqs = array_values($faqs); } @endphp {{ $blog->title }} @foreach($tags as $tag) {{ $tag }} @endforeach {{ $blog->created_at->format('F d, Y') }} @if($blog->feature_image) @endif @if(!empty($blog->description)) {!! $blog->description !!} @endif @if(!empty($faqs)) Frequently Asked Questions @foreach($faqs as $index => $faq) {{ $index + 1 }}. {{ $faq['question'] ?? 'Question' }} {!! isset($faq['answer']) ? nl2br(e($faq['answer'])) : 'Answer not available.' !!} @endforeach @endif @endsection