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