Created
September 8, 2016 03:36
-
-
Save achmadfatoni/5cb71a93bb7dddcbf3b06de6fa4c0edf to your computer and use it in GitHub Desktop.
Laravel slug validation
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
Validator::extend('slug', function($attribute, $value, $parameters, $validator) { | |
return preg_match('/^[a-z0-9]+(?:-[a-z0-9]+)*$/', $value); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
deneme test