merge([ 'terms' => $this->terms ? true : false ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return [ 'first_name' => 'required|min:1', 'last_name' => 'required|min:1', 'email' => 'required|email:rfc,spoof,dns,strict', 'message' => 'required|string|min:10', 'terms' => 'accepted', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed 'g-recaptcha-response' => function (string $attribute, mixed $value, \Closure $fail) { try { ToolboxHelper::validateRecaptcha($this, \config('services.google.recaptcha.version')); } catch (ValidationException $e) { $fail($e->getMessage()); } } ]; } }