*/ protected function casts(): array { return ['value' => 'json']; } public static function getValue(string $key, mixed $default = null): mixed { return Cache::rememberForever( "app-setting.{$key}", fn (): mixed => static::query()->find($key)?->value, ) ?? $default; } public static function getBool(string $key, bool $default = false): bool { return (bool) static::getValue($key, $default); } public static function setValue(string $key, mixed $value): void { static::query()->updateOrCreate(['key' => $key], ['value' => $value]); Cache::forget("app-setting.{$key}"); } }