| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public static function create(array $data): Validator |
||
| 18 | { |
||
| 19 | $rules = [ |
||
| 20 | 'username' => 'required|min:4|max:20|unique:users', |
||
| 21 | 'email' => 'required|email|max:50|unique:users', |
||
| 22 | 'password' => 'required|min:6|confirmed', |
||
| 23 | 'terms' => 'required|min:1' |
||
| 24 | ]; |
||
| 25 | |||
| 26 | // Bipass the captcha for the unit testing. |
||
| 27 | if (App::environment() != 'testing') { |
||
| 28 | $rules = array_merge($rules, ['g-recaptcha-response' => 'required|recaptcha']); |
||
| 29 | } |
||
| 30 | |||
| 31 | return FacadeValidator::make($data, $rules); |
||
| 32 | } |
||
| 33 | } |
||
| 34 |