From 37f7f2d14e7abd3ac6035f0a494279ebc58becde Mon Sep 17 00:00:00 2001 From: Thanasis Naskos Date: Fri, 10 Dec 2021 15:26:34 +0200 Subject: [PATCH] Bug fix --- api/app/Http/Controllers/V1/Partners/XlsiemController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/api/app/Http/Controllers/V1/Partners/XlsiemController.php b/api/app/Http/Controllers/V1/Partners/XlsiemController.php index 2ffa1f7..cb48956 100644 --- a/api/app/Http/Controllers/V1/Partners/XlsiemController.php +++ b/api/app/Http/Controllers/V1/Partners/XlsiemController.php @@ -13,7 +13,7 @@ class XlsiemController extends Controller public function store(XlsiemRequest $request) { $dbEvents = []; - $mqttEvents = []; + $eventAlarms = []; foreach ($request->get('event_alarm') as $ev) { $dbEvents[] = [ 'asset_id' => $request->get('asset_id'), @@ -39,13 +39,12 @@ class XlsiemController extends Controller 'priority' => isset($ev['priority']) ? $ev['priority'] : null, 'confidence' => isset($ev['confidence']) ? $ev['confidence'] : null ]; - Mqtt::ConnectAndPublish('xlsiem/event', json_encode($mqttEvents), 1); } - $mqttEvents = { + $mqttEvents = array( 'asset_id' => $request->get('asset_id'), 'timestamp' => Carbon::createFromTimestamp($request->get('timestamp')), 'event_alarm' => $eventAlarms - }; + ); // publish to MQTT Broker -- 2.2.2