hasHeader('public-token')) { return false; } $captchaToken = $captchaTokenRepository->getCaptchaTokenByPublicToken($this->header('public-token')); if (is_null($captchaToken)) { return false; } $this->captchaToken = $captchaToken; return true; } /** * Get the validation rules that apply to the request. */ public function rules(): array { return [ 'captcha_key' => ['required', 'string', 'max:75'], 'verification' => ['required', 'array'], 'verification.*' => ['required', 'array', 'size:2'], 'verification.*.x' => ['required', 'numeric', 'min:0'], 'verification.*.y' => ['required', 'numeric', 'min:0'], ]; } public function getDto(): CheckingDto { $httpUserData = new HttpUserData( $this->getClientIp(), $this->userAgent(), $this->header('referer') ); $captchaPublicToken = new CaptchaPublicToken( $this->captchaToken, $httpUserData ); return new CheckingDto( captchaPublicToken: $captchaPublicToken, captchaKey: $this->input('captcha_key'), coordinators: $this->input('verification'), ); } }