afea/filament-faq

FAQ module for the Afea Filament CMS package ecosystem: categorized FAQs with polymorphic attachment to any content model.

Maintainers

Package info

github.com/AfeaSoftware/filament-faq

pkg:composer/afea/filament-faq

Statistics

Installs: 1

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-04-21 10:48 UTC

This package is auto-updated.

Last update: 2026-04-21 11:57:38 UTC


README

FAQ module for the Afea Filament CMS package ecosystem.

Ships:

  • Faq and FaqCategory models
  • HasFaqs trait — add to any model to attach FAQs polymorphically through the faqables pivot (carries order so each host orders its FAQs independently)
  • FaqResource, FaqCategoryResource (Filament v4) with reorderable tables
  • FaqsRelationManager — drop into any resource whose model uses HasFaqs
  • FaqPlugin for panel registration
  • afea:install:faq installer

Installation

composer require afea/filament-faq
php artisan afea:install:faq

Register in AdminPanelProvider:

->plugin(\Afea\Cms\Faq\Filament\FaqPlugin::make())

Attaching FAQs to another model

1. Use the trait

use Afea\Cms\Faq\Concerns\HasFaqs;

class BlogPost extends Model
{
    use HasFaqs;
}

2. Drop the relation manager into the host resource

use Afea\Cms\Faq\Filament\RelationManagers\FaqsRelationManager;

class BlogPostResource extends Resource
{
    public static function getRelations(): array
    {
        return [FaqsRelationManager::class];
    }
}

3. Query attached FAQs on the front-end

$post->faqs;                 // ordered by pivot `order`
$post->activeFaqs();         // only active FAQs
$post->syncFaqs([$idA, $idB]); // reorder atomically

Three common scenarios

1. Model override

class Faq extends \Afea\Cms\Faq\Models\Faq
{
    public function scopeVerified(Builder $q): Builder
    {
        return $q->active()->whereNotNull('faq_category_id');
    }
}
'models' => ['faq' => \App\Models\Faq::class],

2. Bulk attach FAQs to every blog post

$post->syncFaqs(\Afea\Cms\Faq\Models\Faq::pluck('id')->all());

3. Render a FAQ section inside a Blade view

@foreach ($page->activeFaqs() as $faq)
    <details>
        <summary>{{ $faq->question }}</summary>
        <div class="prose">{!! $faq->answer !!}</div>
    </details>
@endforeach