table} WHERE email = ? AND deleted_at IS NULL"; $params = [$email]; if ($tenantId) { $sql .= " AND tenant_id = ?"; $params[] = $tenantId; } $stmt = $this->db()->prepare($sql); $stmt->execute($params); return $stmt->fetch() ?: null; } public function findAllByTenant(string $tenantId): array { $stmt = $this->db()->prepare("SELECT id, name, email, role, is_active, created_at FROM {$this->table} WHERE tenant_id = ? AND deleted_at IS NULL"); $stmt->execute([$tenantId]); return $stmt->fetchAll(); } public function findById(string $id, string $tenantId): ?array { $stmt = $this->db()->prepare("SELECT id, name, email, role, is_active, created_at FROM {$this->table} WHERE id = ? AND tenant_id = ? AND deleted_at IS NULL LIMIT 1"); $stmt->execute([$id, $tenantId]); return $stmt->fetch() ?: null; } }