RegistrationProcessRequest::prepareForValidation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Auth\Http\Requests\Tenantarea;
6
7
class RegistrationProcessRequest extends RegistrationRequest
8
{
9
    /**
10
     * Prepare the data for validation.
11
     *
12
     * @return void
13
     */
14
    protected function prepareForValidation(): void
15
    {
16
        $data = $this->all();
17
18
        $data['is_active'] = ! config('cortex.auth.registration.moderated');
19
20
        $this->replace($data);
21
    }
22
23
    /**
24
     * Get the validation rules that apply to the request.
25
     *
26
     * @return array
27
     */
28
    public function rules(): array
29
    {
30
        $rules = app('cortex.auth.member')->getRules();
31
        $rules['password'] = 'required|confirmed|min:'.config('cortex.auth.password_min_chars');
32
33
        return $rules;
34
    }
35
}
36