Update: 2026-05-04 00:09:02

This commit is contained in:
Hamza-Ayed
2026-05-04 00:09:02 +03:00
parent 2ac63eef47
commit 8357add763
2 changed files with 32 additions and 13 deletions

View File

@@ -12,7 +12,11 @@ $db = Database::getInstance();
// 1. Super Admin sees ALL companies
if ($decoded['role'] === 'super_admin') {
$stmt = $db->query("SELECT * FROM companies WHERE deleted_at IS NULL");
$stmt = $db->prepare("SELECT c.*, t.name as tenant_name
FROM companies c
LEFT JOIN tenants t ON c.tenant_id = t.id
WHERE c.deleted_at IS NULL ORDER BY c.created_at DESC");
$stmt->execute();
}
// 2. Admin sees all companies in their tenant
else if ($decoded['role'] === 'admin') {