Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Validation class (Request) and function rules() #96

Open
ma3achou opened this issue Nov 6, 2023 · 0 comments
Open

Issue with Validation class (Request) and function rules() #96

ma3achou opened this issue Nov 6, 2023 · 0 comments

Comments

@ma3achou
Copy link

ma3achou commented Nov 6, 2023

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
image

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant