Created
July 16, 2016 12:38
-
-
Save ivanvermeyen/2e3a2f1ee750d21576dca3172074dc6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Requests; | |
use Illuminate\Foundation\Http\FormRequest; | |
class SomeRequest extends FormRequest | |
{ | |
/** | |
* Validate conditional rules. | |
* | |
* @return \Illuminate\Contracts\Validation\Validator | |
*/ | |
protected function getValidatorInstance() | |
{ | |
$validator = parent::getValidatorInstance(); | |
$validator->sometimes('g-recaptcha-response', 'required|captcha', function ($input) { | |
return ! app()->environment('testing'); | |
}); | |
return $validator; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment