prepare("SELECT id FROM invoices WHERE id = ? AND tenant_id = ? AND deleted_at IS NULL LIMIT 1"); $stmt->execute([$invoiceId, $tenantId]); if (!$stmt->fetch()) { throw new Exception('الفاتورة غير موجودة', 404); } QueueService::push('submit_jofotara', [ 'invoice_id' => $invoiceId ]); } }