Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

Google reCaptcha is absent in $request variable

I am working on a Google reCaptcha Registration page using Laravel 8. I am not using any package.

I added below code in header.

<script src='https://www.google.com/recaptcha/api.js' async defer></script>

My blade file code is like below

<form method="POST" action="{{ url('/register') }}" enctype="multipart/form-data">
    @csrf
<div class="form-group mt-5">
     <div class="g-recaptcha" data-sitekey="sitekeytext"></div>
</div>
@error('g-recaptcha-response')
     <div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
<button type="submit" class="btn mt-3 mb-5">Submit</button>
</form>

I checked reCaptcha check box in Registration page and submitted the form

I am debugging using below code in Controller.

public function store(Request $request)
{ 
    dd($request);  // `g-recaptcha-response` is absent here
}

Why g-recaptcha-response is absent here ?

0 likes
3 replies

Please or to participate in this conversation.