Skip to content

Commit b9f4d31

Browse files
committed
🐛 correction du bug sur l'assignation du role pendant la creation du compte
1 parent c1c0ad2 commit b9f4d31

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/Actions/Fortify/CreateNewUser.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,17 @@ public function create(array $input): User
4242
'password' => $this->passwordRules(),
4343
])->validate();
4444

45-
return User::create([
45+
/** @var User $user */
46+
$user = User::create([
4647
'name' => $input['name'],
4748
'email' => $input['email'],
4849
'username' => Str::lower($input['username']),
4950
'password' => Hash::make($input['password']),
5051
'opt_in' => isset($input['opt_in']),
5152
]);
53+
54+
$user->assignRole('user');
55+
56+
return $user;
5257
}
5358
}

0 commit comments

Comments
 (0)