Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled
38 lines
1.2 KiB
PHP
Executable File
38 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Bastion\Services;
|
|
|
|
use Openguru\OpenCartFramework\Cache\CacheInterface;
|
|
use Openguru\OpenCartFramework\OpenCart\Decorators\OcRegistryDecorator;
|
|
use Openguru\OpenCartFramework\QueryBuilder\Connections\ConnectionInterface;
|
|
use Openguru\OpenCartFramework\Support\Arr;
|
|
|
|
class SettingsService
|
|
{
|
|
private OcRegistryDecorator $registry;
|
|
private CacheInterface $cache;
|
|
private ConnectionInterface $connection;
|
|
|
|
public function __construct(OcRegistryDecorator $registry, CacheInterface $cache, ConnectionInterface $connection)
|
|
{
|
|
$this->registry = $registry;
|
|
$this->cache = $cache;
|
|
$this->connection = $connection;
|
|
}
|
|
|
|
public function update(array $data): void
|
|
{
|
|
$this->connection->transaction(function () use ($data) {
|
|
$this->registry->model_setting_setting->editSetting('module_megapay', [
|
|
'module_megapay_settings' => $data,
|
|
]);
|
|
|
|
$this->registry->model_setting_setting->editSetting('module_tgshop', [
|
|
'module_tgshop_status' => Arr::get($data, 'app.app_enabled', false) ? 1 : 0,
|
|
]);
|
|
});
|
|
|
|
$this->cache->clear();
|
|
}
|
|
}
|