Laravel faq dynamic process
//Front end visa faq display route
Route::get('/visa/faqs', [VisaFaqController::class, 'index'])->name('visa.faq');
Migration:
$table->id();
$table->string('question'); // Question heading
$table->longText('answer'); // Answer text
$table->timestamps();
//for frontend display
<section class="faq">
@php
$faqs = App\Models\VisaFaq::all();
@endphp
@foreach($faqs as $faq)
<button class="accordion">{{$faq->question}}</button>
<div class="panel">
<p>{{$faq->answer}}</p>
</div>
@endforeach
</section>
No comments