josiasmontag / laravel-recaptchav3

Laravel package for Google's Recaptcha V3
MIT License
188 stars 37 forks source link

Bug : validateRecaptchav3 does not exist #2

Closed Nuranto closed 5 years ago

Nuranto commented 5 years ago

Here is an error I get when submitting a form

Method Illuminate\Validation\Validator::validateRecaptchav3 does not exist

After some debugging, it seems the extend('recaptchav3' of the provider is not called before the validation.

The only solution was to move the extend code to my AppServiceProvider::boot...

Note that I add the provider to my config/app.php :

\Lunaweb\RecaptchaV3\Providers\RecaptchaV3ServiceProvider::class,

and that I ran a config:clear and a cache:clear. If I add a die in the RecaptchaV3ServiceProvider, it got executed when I load a page, but not when I post a form (the error above occurs before it can).

I'm new to laravel, so it's probably a mistake of mine, right ?

josiasmontag commented 5 years ago

The $defer in RecaptchaV3ServiceProvider is most likely the problem. Setting it to false should solve it. I will push an update later.

Nuranto commented 5 years ago

Oh, indeed :) Just made a test, and it works fine with $defer = false !

Thanks

gonself commented 3 years ago

Hi! If someone has the same error, I have manually added the providoer to config/app.php

Bye