| 1 | <?php |
||
| 8 | class AppServiceProvider extends ServiceProvider |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Bootstrap any application services. |
||
| 12 | * |
||
| 13 | * @return void |
||
| 14 | */ |
||
| 15 | public function boot() |
||
| 16 | { |
||
| 17 | /* |
||
| 18 | * Custom validation rules |
||
| 19 | */ |
||
| 20 | 35 | Validator::extend('alpha_spaces', function ($attribute, $value) { |
|
| 21 | // Accept only alpha and spaces. |
||
| 22 | 1 | return preg_match('/^[\pL\s]+$/u', $value); |
|
| 23 | 35 | }); |
|
| 24 | |||
| 25 | 35 | Validator::extend('alpha_spaces_hyphens', function ($attribute, $value) { |
|
| 26 | // Accept only alpha, spaces and hyphens. |
||
| 27 | 1 | return preg_match('/^[\pL\s-]+$/u', $value); |
|
| 28 | 35 | }); |
|
| 29 | 35 | } |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Register any application services. |
||
| 33 | * |
||
| 34 | * @return void |
||
| 35 | */ |
||
| 36 | 35 | public function register() |
|
| 40 | } |
||
| 41 |