@php $faqItems = collect($faqs ?? [])->sort(function ($left, $right) { $topicComparison = strcasecmp( (string) ($left->faq_category ?: 'General'), (string) ($right->faq_category ?: 'General') ); if ($topicComparison !== 0) { return $topicComparison; } $orderComparison = ((int) ($left->sort_order ?? 0)) <=> ((int) ($right->sort_order ?? 0)); return $orderComparison !== 0 ? $orderComparison : ((int) $left->id <=> (int) $right->id); })->values(); $faqGroups = $faqItems ->groupBy(function ($faq) { $slug = trim((string) ($faq->category_slug ?? '')); return $slug !== '' ? $slug : (\Illuminate\Support\Str::slug((string) ($faq->faq_category ?: 'General')) ?: 'general'); }) ->sortBy(function ($items, $slug) { $label = strtolower((string) optional($items->first())->faq_category ?: 'general'); return ($slug === 'general' ? '0-' : '1-').$label; }); $faqTopicNames = $faqGroups ->map(fn ($items) => (string) (optional($items->first())->faq_category ?: 'General')) ->values(); $publishedFaqCount = $faqItems->filter(fn ($faq) => (bool) ($faq->is_active ?? true))->count(); @endphp
Assign every question to a topic. Topic names automatically become the tabs shown on the public FAQ page.
{{ $topicFaqs->count() }} questions ยท {{ $topicPublishedCount }} published
{{ \Illuminate\Support\Str::limit(strip_tags((string) $faq->answer), 240) }}
Add the first question and enter a topic name. The topic will become a tab on the public FAQ page.
Try another search term or clear the search field.