From 258805d179d240a473a3652fb7d74f4467530224 Mon Sep 17 00:00:00 2001 From: Fabio Widmer Date: Tue, 30 Apr 2019 13:47:17 +0200 Subject: [PATCH 1/2] Update BotDetectCaptcha.php --- src/BotDetectCaptcha.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BotDetectCaptcha.php b/src/BotDetectCaptcha.php index 9dbe751..808d10e 100644 --- a/src/BotDetectCaptcha.php +++ b/src/BotDetectCaptcha.php @@ -15,7 +15,7 @@ class BotDetectCaptcha /** * @var object */ - private static $instance; + private static $instances = []; /** * BotDetect Laravel CAPTCHA package information. @@ -32,7 +32,7 @@ class BotDetectCaptcha */ public function __construct($configName, $captchaInstanceId = null) { - self::$instance = $this; + self::$instances[$configName] = $this; // load BotDetect Library LibraryLoader::load(); @@ -79,9 +79,9 @@ public function initCaptcha(array $config, $captchaInstanceId = null) * * @return object */ - public static function getInstance() + public static function getInstance($configName) { - return self::$instance; + return array_key_exists($configName, self::$instances) ? self::$instances[$configName] : null; } public function __call($method, $args = array()) From 8797bba0815b7d09a6e3b96b002f70915b945fa9 Mon Sep 17 00:00:00 2001 From: Fabio Widmer Date: Tue, 30 Apr 2019 13:47:51 +0200 Subject: [PATCH 2/2] Update helpers.php --- src/Support/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Support/helpers.php b/src/Support/helpers.php index beaa99f..aa49502 100644 --- a/src/Support/helpers.php +++ b/src/Support/helpers.php @@ -69,7 +69,7 @@ function captcha_library_is_loaded() */ function captcha_instance($captchaId) { - $captcha = BotDetectCaptcha::getInstance(); + $captcha = BotDetectCaptcha::getInstance($captchaId); return (null !== $captcha) ? $captcha : new BotDetectCaptcha($captchaId); } }