| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 1.0007 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function boot() |
||
| 16 | { |
||
| 17 | /* |
||
| 18 | * Custom validation rules |
||
| 19 | */ |
||
| 20 | 41 | Validator::extend('alpha_spaces', function ($attribute, $value) { |
|
| 21 | // Accept only alpha and spaces. |
||
| 22 | 5 | return preg_match('/^[\pL\s]+$/u', $value); |
|
| 23 | 41 | }); |
|
| 24 | |||
| 25 | 41 | Validator::extend('alpha_spaces_hyphens', function ($attribute, $value) { |
|
| 26 | // Accept only alpha, spaces and hyphens. |
||
| 27 | return preg_match('/^[\pL\s-]+$/u', $value); |
||
| 28 | 41 | }); |
|
| 29 | |||
| 30 | 41 | Validator::extend('alpha_spaces_hyphens_apostrophes', function ($attribute, $value) { |
|
| 31 | // Accept only alpha, spaces, hyphens and apostrophes. |
||
| 32 | 5 | return preg_match('/^[\pL\s-\']+$/u', $value); |
|
| 33 | 41 | }); |
|
| 34 | |||
| 35 | 41 | Validator::extend('alpha_spaces_hyphens_apostrophes_parentheses', function ($attribute, $value) { |
|
| 36 | // Accept only alpha, spaces, hyphens and apostrophes. |
||
| 37 | 5 | return preg_match('/^[\pL\s-\'()]+$/u', $value); |
|
| 38 | 41 | }); |
|
| 51 |