Files
musadaq-saas/app/modules_app/tenants/index.php
2026-05-03 23:08:56 +03:00

21 lines
435 B
PHP

<?php
/**
* Tenants List Endpoint (Super Admin Only)
*/
use App\Core\Database;
use App\Middleware\AuthMiddleware;
$decoded = AuthMiddleware::check();
if ($decoded['role'] !== 'super_admin') {
json_error('Unauthorized', 403);
}
$db = Database::getInstance();
$stmt = $db->query("SELECT id, name, email, phone, status, created_at FROM tenants ORDER BY created_at DESC");
$tenants = $stmt->fetchAll();
json_success($tenants);