-
-
Save LespiletteMaxime/6b32d3cba36030e9394b to your computer and use it in GitHub Desktop.
Filter alpha + space Laravel
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 | |
/* app/validators.php */ | |
Validator::extend('alpha_spaces', function($attribute, $value) | |
{ | |
return preg_match('/^[\pL\s]+$/u', $value); | |
}); | |
/* | |
* add the validators.php file in start/global.php: require app_path().'/validators.php' | |
* and use it as usual: $rules = array('name' => 'required|alpha_spaces',); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment