| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 | |||
| 41 |