Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/BotDetectCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BotDetectCaptcha
/**
* @var object
*/
private static $instance;
private static $instances = [];

/**
* BotDetect Laravel CAPTCHA package information.
Expand All @@ -32,7 +32,7 @@ class BotDetectCaptcha
*/
public function __construct($configName, $captchaInstanceId = null)
{
self::$instance = $this;
self::$instances[$configName] = $this;

// load BotDetect Library
LibraryLoader::load();
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion src/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down