- Laravel 11, Blade, Alpine.js, Tailwind CSS - Produkt- & Kategorieverwaltung mit Varianten - Checkout (Vorkasse + Rechnung), Session-Warenkorb - Admin-Backend (Dashboard, Bestellungen, Kunden, CMS) - DSGVO-konform: Cookie-Consent, Impressum, Widerruf, AGB - PDF-Rechnung via dompdf, SMTP-Mailversand - Kundenverwaltung mit manueller Freischaltung Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Faq;
|
|
use App\Models\FaqGroup;
|
|
use Illuminate\Http\Request;
|
|
|
|
class FaqController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$groups = FaqGroup::with('faqs')->orderBy('sort_order')->get();
|
|
return view('admin.faqs.index', compact('groups'));
|
|
}
|
|
|
|
public function storeGroup(Request $request)
|
|
{
|
|
$data = $request->validate(['name' => 'required|string|max:255', 'sort_order' => 'integer']);
|
|
FaqGroup::create($data);
|
|
return back()->with('success', 'Gruppe erstellt.');
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$data = $request->validate([
|
|
'faq_group_id' => 'nullable|exists:faq_groups,id',
|
|
'question' => 'required|string|max:500',
|
|
'answer' => 'required|string',
|
|
'sort_order' => 'integer',
|
|
]);
|
|
Faq::create($data);
|
|
return back()->with('success', 'FAQ erstellt.');
|
|
}
|
|
|
|
public function update(Request $request, Faq $faq)
|
|
{
|
|
$data = $request->validate([
|
|
'question' => 'required|string|max:500',
|
|
'answer' => 'required|string',
|
|
'sort_order' => 'integer',
|
|
]);
|
|
$faq->update($data);
|
|
return back()->with('success', 'FAQ aktualisiert.');
|
|
}
|
|
|
|
public function destroy(Faq $faq)
|
|
{
|
|
$faq->delete();
|
|
return back()->with('success', 'FAQ gelöscht.');
|
|
}
|
|
}
|