#add git monitor

This commit is contained in:
2025-12-18 10:18:25 +08:00
parent 2ec44b5665
commit 5f6bba1d9f
18 changed files with 889 additions and 20 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Services;
use App\Models\Config;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Schema;
class ConfigService
{
public function get(string $key, mixed $default = null): mixed
{
$config = Config::query()->where('key', $key)->first();
return $config?->value ?? $default;
}
public function getNested(string $key, string $path, mixed $default = null): mixed
{
$value = $this->get($key);
return Arr::get($value ?? [], $path, $default);
}
public function set(string $key, mixed $value, ?string $description = null): Config
{
return Config::query()->updateOrCreate(
['key' => $key],
[
'value' => $value,
'description' => $description,
]
);
}
public function setNested(string $key, string $path, mixed $value, ?string $description = null): Config
{
$payload = $this->get($key, []);
Arr::set($payload, $path, $value);
return $this->set($key, $payload, $description);
}
}