initial commit

This commit is contained in:
TheOnlyMace
2026-05-17 13:26:14 +02:00
commit 75299b723d
176 changed files with 20327 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
class SystemSetting extends Model
{
protected $primaryKey = 'key';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = ['key', 'value'];
public static function get(string $key, mixed $default = null): mixed
{
return Cache::remember("setting.{$key}", 300, function () use ($key, $default) {
$row = static::query()->find($key);
return $row?->value ?? $default;
});
}
public static function set(string $key, mixed $value): void
{
static::query()->updateOrCreate(['key' => $key], ['value' => (string) $value]);
Cache::forget("setting.{$key}");
}
}