We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 2 |
| Paths | 1 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2.0932 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 7 | public function boot() |
|
| 16 | { |
||
| 17 | // User::observe(UserObserver::class); |
||
| 18 | |||
| 19 | // Extend the Validator class. |
||
| 20 | // To check the user age (minimum: 16) |
||
| 21 | 7 | Validator::extend( |
|
| 22 | 7 | 'olderThan', function($attributes, $value, $parameters) { |
|
| 23 | $minAge = (!empty($parameters)) ? (int) $parameters[ 0 ] : 16; |
||
| 24 | return \Carbon\Carbon::now()->diff(new \Carbon\Carbon($value))->y >= $minAge; |
||
| 25 | 7 | } |
|
| 26 | ); |
||
| 27 | 7 | } |
|
| 28 | |||
| 36 |