🆙 phpstan done an refactoring 🆙

This commit is contained in:
Remco
2026-01-20 20:40:28 +01:00
parent fccf4c2116
commit 981fd59af5
14 changed files with 148 additions and 126 deletions
@@ -52,12 +52,18 @@ class CreateNewUser implements CreatesNewUsers
]);
}
$this->validate($input);
$validated = $this->validate($input);
if (! is_string($validated['username']) || ! is_string($validated['mail']) || ! is_string($validated['password'])) {
throw ValidationException::withMessages([
'registration' => __('Invalid registration data types'),
]);
}
$user = User::create([
'username' => $input['username'],
'mail' => $input['mail'],
'password' => Hash::make((string) $input['password']),
'username' => $validated['username'],
'mail' => $validated['mail'],
'password' => Hash::make($validated['password']),
'account_created' => time(),
'last_login' => time(),
'motto' => setting('start_motto') ?: 'Welcome to the hotel!',