Skip to content

Instantly share code, notes, and snippets.

@jrean
Forked from elena-kolevska/validators.php
Created April 16, 2014 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrean/10902730 to your computer and use it in GitHub Desktop.
Save jrean/10902730 to your computer and use it in GitHub Desktop.
<?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