Mahmoud Santos
Published in : 2022-02-23

How can I validate recaptcha in Livewire class ??

Laravel

Hello guys, Please anyone can help me to do Recaptcha in the Livewire class?

I recently moved my contact form to a livewire component and everything works except my google Recaptcha it no longer works.

// Validate contact info $this->validate([ 'name' => 'required|min:4|max:30', 'email' => 'required|email', 'subject' => 'required|min:5|max:100', 'message' => 'required|min:30|max:500', 'g-recaptcha-response' => config('services.recaptcha.key') ? 'required|recaptcha' : 'nullable', ]);

component form

<!-- google recaptcha --> @if(config('services.recaptcha.key')) <div > <div wire:model.defer="g-recaptcha-response" data-sitekey="{{config('services.recaptcha.key')}}"> </div> @error('g-recaptcha-response') <span role="alert"> <strong>{{ $message }}</strong> </span> @enderror </div> @endif

 

Comments

Yasen Sayed Date : 2022-02-23

Best answers

8

Best answers

8

If you know Arabic I made a small video to describe how you can use it.

You should follow the next steps in the video, I hope these are will help you.

 

//www.youtube.com/watch?v=TFJCHny_VgU&ab_channel=LARATRICKS

Mahmoud Santos Date : 2022-02-23

Thank you, that was really helpful 

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Laravel install passport have access denied error
Publish date: 2022-02-23 | Comments: 4
How to check Laravel version?
Publish date: 2022-04-07 | Comments: 2
Undefined Variable problem on Laravel 9.x
Publish date: 2022-03-06 | Comments: 3
[solved] Class "App\Exceptions\Client" not found
Publish date: 2022-02-09 | Comments: 2
API CORS error in Laravel 9x
Publish date: 2022-08-03 | Comments: 2
Laravel Network is unreachable stream_socket_client 587
Publish date: 2022-02-16 | Comments: 4