Laravel recaptcha validation in registrar does not work -


i newbie in laravel. i've used recaptcha package: https://github.com/greggilbert/recaptcha , documentation saids that: in validation rules, add following:

$rules = array(         // ...         'g-recaptcha-response' => 'required|recaptcha',     }; 

by way use laravel 5's registrar:

<?php namespace taxman\services;  use taxman\user; use validator; use illuminate\contracts\auth\registrar registrarcontract;  class registrar implements registrarcontract {      /**      * validator incoming registration request.      *      * @param  array  $data      * @return \illuminate\contracts\validation\validator      */     public function validator(array $data)     {         return validator::make($data, [             'name' => 'required|max:255',             'email' => 'required|email|max:255|unique:users',             'password' => 'required|confirmed|min:4',             'telephone' => 'required',             'g-recaptcha-response' => 'required|recaptcha',         ]);     }      /**      * create new user instance after valid registration.      *      * @param  array  $data      * @return user      */     public function create(array $data)     {         return user::create([             'name' => $data['name'],             'email' => $data['email'],             'password' => bcrypt($data['password']),         ]);     }  } 

but in case laravel return error message: "the g-recaptcha-response required", in view used command:

<div class="form-group">          {!! recaptcha::render() !!}  </div> 

and yes, field not empty!

so, think, should put 'g-recaptcha-response' => 'required|recaptcha' somewhere else? because seems, in registrar's validator not work.

if still pulling hair because of issue remove 'recaptcha' in validation rule.

use

'g-recaptcha-response' => 'required' 

instead of

'g-recaptcha-response' => 'required|recaptcha' 

see http://tuts.codingo.me/google-recaptcha-in-laravel-application/


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -