db()->prepare("SELECT * FROM {$this->table} WHERE tenant_id = ? AND deleted_at IS NULL ORDER BY created_at DESC"); $stmt->execute([$tenantId]); return $stmt->fetchAll(); } public function findByStatus(string $status, ?string $tenantId = null): array { $sql = "SELECT * FROM {$this->table} WHERE status = ? AND deleted_at IS NULL"; $params = [$status]; if ($tenantId) { $sql .= " AND tenant_id = ?"; $params[] = $tenantId; } $stmt = $this->db()->prepare($sql); $stmt->execute($params); return $stmt->fetchAll(); } }