Update: 2026-05-04 00:13:56
This commit is contained in:
@@ -40,11 +40,14 @@ try {
|
||||
);
|
||||
|
||||
// 1. Create Tenant
|
||||
$encryptedTenantName = \App\Core\Encryption::encrypt($data['name']);
|
||||
$encryptedTenantEmail = \App\Core\Encryption::encrypt($data['email']);
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO tenants (id, name, email, phone, status, created_at) VALUES (?, ?, ?, ?, 'active', NOW())");
|
||||
$stmt->execute([
|
||||
$tenantId,
|
||||
$data['name'],
|
||||
$data['email'],
|
||||
$encryptedTenantName,
|
||||
$encryptedTenantEmail,
|
||||
$data['phone'] ?? null
|
||||
]);
|
||||
|
||||
|
||||
@@ -17,4 +17,12 @@ $db = Database::getInstance();
|
||||
$stmt = $db->query("SELECT id, name, email, phone, status, created_at FROM tenants ORDER BY created_at DESC");
|
||||
$tenants = $stmt->fetchAll();
|
||||
|
||||
foreach ($tenants as &$t) {
|
||||
$decName = \App\Core\Encryption::decrypt($t['name']);
|
||||
$t['name'] = $decName !== false ? $decName : $t['name'];
|
||||
|
||||
$decEmail = \App\Core\Encryption::decrypt($t['email']);
|
||||
$t['email'] = $decEmail !== false ? $decEmail : $t['email'];
|
||||
}
|
||||
|
||||
json_success($tenants);
|
||||
|
||||
Reference in New Issue
Block a user