To add a new validation to Laravel I have done this:
made a new file called customValidation.php
in app/start/
and then included it in
I would create custom app/validators
folder for this then.
1, Create app/validators/CustomValidate.php
2, run php artisan optimize
or composer dumpautoload
3, Somewhere register your custom validator. Perhaps add app/validators.php
into start/global.php
Validator::resolver(function($translator, $data, $rules, $message){
return new CustomValidate($translator, $data, $rules, $message);
});
4, Validate
$rules = ['agreed' => 'checkbox'];
$data = ['agreed' => 0];
$v = Validator::make($data, $rules);
dd($v->passes());