merge product controller with kashkool

This commit is contained in:
2026-05-25 19:42:48 +03:30
parent da9498cb51
commit 6ade379944
3 changed files with 268 additions and 79 deletions
+16 -3
View File
@@ -6,14 +6,27 @@ use App\Models\Setting;
class ConfigService
{
public function Config($name)
public function Config($name, $default = false)
{
return Setting::where('key', $name)->value('value') ?? false;
$value = Setting::where('key', $name)->value('value');
return $value !== null ? $value : $default;
}
public function ConfigBool(string $name, bool $default = false): bool
{
$value = $this->Config($name, null);
if ($value === null) {
return $default;
}
return in_array(strtolower(trim((string) $value)), ['1', 'true', 'yes', 'on'], true);
}
public function UpdateConfig($name, $value)
{
return \App\Models\Setting::updateOrCreate(
return Setting::updateOrCreate(
['key' => $name],
['value' => $value]
);