Files
WitShop/app/Models/Setting.php
T
marcoandClaude Sonnet 4.6 41078fdc08 Initial commit: WitShop Laravel Online-Shop
- 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>
2026-06-20 00:34:09 +02:00

25 lines
632 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
class Setting extends Model
{
protected $fillable = ['key','value'];
public static function get(string $key, mixed $default = null): mixed
{
return Cache::remember("setting_{$key}", 3600, function () use ($key, $default) {
return self::where('key', $key)->value('value') ?? $default;
});
}
public static function set(string $key, mixed $value): void
{
self::updateOrCreate(['key' => $key], ['value' => $value]);
Cache::forget("setting_{$key}");
}
}