diff --git a/src/NoCaptcha.php b/src/NoCaptcha.php index 6463847..0c2eafd 100644 --- a/src/NoCaptcha.php +++ b/src/NoCaptcha.php @@ -29,6 +29,11 @@ class NoCaptcha */ protected $http; + /** + * API requested control + */ + protected $api_requested = false; + /** * NoCaptcha. * @@ -53,7 +58,11 @@ public function display($attributes = [], $lang = null) { $attributes['data-sitekey'] = $this->sitekey; - $html = ''."\n"; + $html = ''; + if (empty($this->api_requested)) { + $this->api_requested = true; + $html .= ''."\n"; + } $html .= '
buildAttributes($attributes).'>
'; return $html; diff --git a/src/NoCaptchaServiceProvider.php b/src/NoCaptchaServiceProvider.php index 3886a2d..9933434 100644 --- a/src/NoCaptchaServiceProvider.php +++ b/src/NoCaptchaServiceProvider.php @@ -52,7 +52,7 @@ protected function bootConfig() */ public function register() { - $this->app->bind('captcha', function ($app) { + $this->app->singleton('captcha', function ($app) { return new NoCaptcha( $app['config']['captcha.secret'], $app['config']['captcha.sitekey']