From 3fd78ca0e58d7df31744b61de6fb306ff13a3d17 Mon Sep 17 00:00:00 2001 From: Alex Chertin Date: Sun, 1 Jul 2018 16:10:57 +0300 Subject: [PATCH] Validation fails. Error code: timeout-or-duplicate #140 it could be nice to cache the first response, so in the code if the same validation is called few times it will return the first validation result --- src/RecaptchaServiceProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RecaptchaServiceProvider.php b/src/RecaptchaServiceProvider.php index df0b5f7..bd05941 100644 --- a/src/RecaptchaServiceProvider.php +++ b/src/RecaptchaServiceProvider.php @@ -35,8 +35,8 @@ public function boot() */ public function addValidator() { - $this->app->validator->extendImplicit('recaptcha', function ($attribute, $value, $parameters) { - $captcha = app('recaptcha.service'); + $captcha = app('recaptcha.service'); + $this->app->validator->extendImplicit('recaptcha', function ($attribute, $value, $parameters) use($captcha) { $challenge = app('request')->input($captcha->getResponseKey()); return $captcha->check($challenge, $value);