From 806bfcf316c52ef2a661e5222309dbe15e9bcf44 Mon Sep 17 00:00:00 2001 From: RobbeStatik Date: Thu, 17 Nov 2022 10:36:08 +0100 Subject: [PATCH] Fixed collector retrieval in webhook controller --- src/Http/Controllers/Api/SurveyheroWebhookController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Controllers/Api/SurveyheroWebhookController.php b/src/Http/Controllers/Api/SurveyheroWebhookController.php index 38d02ec..96e9e03 100644 --- a/src/Http/Controllers/Api/SurveyheroWebhookController.php +++ b/src/Http/Controllers/Api/SurveyheroWebhookController.php @@ -33,7 +33,7 @@ public function handleResponseCompletedWebhook(SurveyResponseImportService $surv } //Check if response is from a configured collector, if not configured we do not import the response. - $collectors = $questionMapping[0]['collectors']; + $collectors = collect($questionMapping)->where('survey_id', $responseData['survey_id'])->pluck('collectors')->first(); Log::info($collectors); if ($collectors && count($collectors) > 0 && ! in_array($responseData['collector_id'], $collectors)) { return response()->json([