so I'm adding Google's recaptcha to my Laravel project. I'm using the basic Auth that comes with Laravel 5.1. I'm using this class for the recaptcha https://github.com/greggilbert/recaptcha
In my AuthController.php I have this function which is validating my current form. I would however like to add a check for the racaptcha but only when the server is production....
/**
* Get a validator for an incoming registration request.
*
* @param array $data
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
'g-recaptcha-response' => 'required|recaptcha',
]);
}
The part of the validator that I only want on product is
'g-recaptcha-response' => 'required|recaptcha',
What would be the easiest way to achieve this?