CreateNewUser   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 22
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 12 1
1
<?php
2
3
namespace App\Actions\Fortify;
4
5
use App\Models\User;
6
use Illuminate\Support\Facades\Hash;
7
use Illuminate\Support\Facades\Validator;
8
use Laravel\Fortify\Contracts\CreatesNewUsers;
9
10
class CreateNewUser implements CreatesNewUsers
11
{
12
    use PasswordValidationRules;
13
14
    /**
15
     * Validate and create a newly registered user.
16
     *
17
     * @param  array  $input
18
     * @return \App\Models\User
19
     */
20
    public function create(array $input)
21
    {
22
        Validator::make($input, [
23
            'name' => ['required', 'string', 'max:255'],
24
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
25
            'password' => $this->passwordRules(),
26
        ])->validate();
27
28
        return User::create([
29
            'name' => $input['name'],
30
            'email' => $input['email'],
31
            'password' => Hash::make($input['password']),
32
        ]);
33
    }
34
}
35