From bd737e4d79925c85b18a134647610c6ce408757a Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Mon, 3 Dec 2018 13:35:17 +0100 Subject: [PATCH 1/2] wip --- src/Statistics/Logging/Statistic.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Statistics/Logging/Statistic.php b/src/Statistics/Logging/Statistic.php index 1fde485..d4ce2a3 100644 --- a/src/Statistics/Logging/Statistic.php +++ b/src/Statistics/Logging/Statistic.php @@ -2,6 +2,8 @@ namespace BeyondCode\LaravelWebSockets\Statistics\Logging; +use BeyondCode\LaravelWebSockets\Apps\App; + class Statistic { protected $appId; @@ -23,6 +25,11 @@ class Statistic $this->appId = $appId; } + public function isEnabled(): bool + { + return App::findById($this->appId)->statisticsEnabled; + } + public function connection() { $this->connections++; From 6386e791aa3459650a07c4a7a5c645cf093aee20 Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Mon, 3 Dec 2018 13:37:30 +0100 Subject: [PATCH 2/2] wip --- src/Statistics/Logging/Logger.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Statistics/Logging/Logger.php b/src/Statistics/Logging/Logger.php index aa929b4..ffc183c 100644 --- a/src/Statistics/Logging/Logger.php +++ b/src/Statistics/Logging/Logger.php @@ -57,7 +57,9 @@ class Logger public function save() { foreach ($this->statistics as $appId => $statistic) { - // TODO: perform http request + if ($statistic->isEnabled()) { + // TODO: perform http request + } // Reset connection and message count $connections = Collection::make($this->channelManager->getChannels($appId))->sum(function ($channel) {