- 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>
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Attribute;
|
|
use App\Models\AttributeValue;
|
|
use Illuminate\Http\Request;
|
|
|
|
class AttributeController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$attributes = Attribute::with('values')->get();
|
|
return view('admin.attributes.index', compact('attributes'));
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$data = $request->validate(['name' => 'required|string|max:255']);
|
|
Attribute::create($data);
|
|
return back()->with('success', 'Attribut erstellt.');
|
|
}
|
|
|
|
public function destroy(Attribute $attribute)
|
|
{
|
|
$attribute->delete();
|
|
return back()->with('success', 'Attribut gelöscht.');
|
|
}
|
|
|
|
public function storeValue(Request $request, Attribute $attribute)
|
|
{
|
|
$data = $request->validate([
|
|
'value' => 'required|string|max:255',
|
|
'sort_order' => 'integer',
|
|
]);
|
|
$attribute->values()->create($data);
|
|
return back()->with('success', 'Wert hinzugefügt.');
|
|
}
|
|
|
|
public function destroyValue(AttributeValue $value)
|
|
{
|
|
$value->delete();
|
|
return back()->with('success', 'Wert gelöscht.');
|
|
}
|
|
}
|