laravel-google-recaptcha-v3
laravel-google-recaptcha-v3 copied to clipboard
Issue with Validation class (Request) and function rules()
Hello friends,
My env : Laravel 8, PHP7.3, Vue.Js 2.0
I don't know what's wrong with that ... why he is waiting for a string ?
This my validation class
use Modules\Core\Http\Requests\Request;
use TimeHunter\LaravelGoogleReCaptchaV3\Validations\GoogleReCaptchaV3ValidationRule;
class RegisterRequest extends Request {
public function rules()
{
return [
'first_name' => ['required'],
'last_name' => ['required'],
'email' => ['required', 'email', 'unique:users'],
'phone' => ['required'],
'password' => ['required', 'confirmed', 'min:6'],
'g-recaptcha-response' => [new GoogleReCaptchaV3ValidationRule('register')],
'privacy_policy' => ['accepted'],
];
}
}
My blade file :
<div class="form-group p-t-5 d-flex justify-content-between">
{!! GoogleReCaptchaV3::renderField('grecaptcha','register') !!}
@error('g-recaptcha-response')
<span class="error-message">{{ $message }}</span>
@enderror
</div>
When I post I get this error :
TypeError
strpos(): Argument #1 ($haystack) must be of type string, TimeHunter\LaravelGoogleReCaptchaV3\Validations\GoogleReCaptchaV3ValidationRule given
http://192.168.1.169:8000/fr/register
With dd() I get the object :
TimeHunter\LaravelGoogleReCaptchaV3\Validations\GoogleReCaptchaV3ValidationRule {#2212 ▼
#action: "register"
#ip: null
#message: null
}
Is the documentation is not full in the case we use validation class ?
Screenshot of Error 500
Thank you :)