From 635ac89f637386048328c3c9a00c50b19a99cb27 Mon Sep 17 00:00:00 2001 From: Tojo RODIALSON Date: Fri, 9 Jul 2021 19:52:07 +0300 Subject: [PATCH] fix json message --- README.md | 2 +- src/Hcaptcha.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 32d2fa1..46c4aac 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Create an account on https://www.hcaptcha.com for having `secret_key` and `site_ $response = Hcaptcha::verify($request->get('h-captcha-response')); //add condition for response - if($response){ + if($response->success){ $msg = "Robot verification success"; }else{ $msg = "Robot verification failed"; diff --git a/src/Hcaptcha.php b/src/Hcaptcha.php index a884e86..c37a841 100644 --- a/src/Hcaptcha.php +++ b/src/Hcaptcha.php @@ -3,6 +3,7 @@ namespace Codise\Hclaravel; use Illuminate\Support\Facades\Http; +use Response; use GuzzleHttp\Client; class Hcaptcha @@ -24,7 +25,7 @@ public static function verify($response) { $json = json_decode($body); return $json; } catch(\Exception $e) { - return response()->json(['error' => $e->getMessage()]); + return Response::json(['error' => $e->getMessage()]); } } }