Files
moonwell-web/app/Services/StoreAvailabilityService.php
T
2026-10-03 14:33:08 +04:00

34 lines
728 B
PHP

<?php
namespace App\Services;
use Illuminate\Support\Facades\DB;
use Throwable;
class StoreAvailabilityService
{
private const CONFIG_ID = 1;
public function isEnabled(): bool
{
try {
return (bool) DB::connection('store')
->table('store_config')
->where('id', self::CONFIG_ID)
->value('enabled');
} catch (Throwable $exception) {
report($exception);
return false;
}
}
public function setEnabled(bool $enabled): void
{
DB::connection('store')
->table('store_config')
->where('id', self::CONFIG_ID)
->update(['enabled' => (int) $enabled]);
}
}