You can extend the validator using your own rules:
Validator::extend('without_spaces', function($attr, $value){ return preg_match('/^\S*$/u', $value); });
Then just use it like any other rule:
required|without_spaces|unique:user_detail,username
Place an order for documents according to user verification rules:
https://laravel.com/docs/5.2/validation#custom-validation-rules
source share