Se adjuntan columnas de apellido paterno y materno para el usuario y validaciones de registro de usuario independiente

This commit is contained in:
2026-03-07 11:03:25 -06:00
parent 3b281faf00
commit 66081df825
10 changed files with 64 additions and 32 deletions
+11 -14
View File
@@ -16,28 +16,27 @@ class CreateNewUser implements CreatesNewUsers
public function create(array $input)
{
if( $input['plantels'] == 0){
throw ValidationException::withMessages([
'plantels' => ['Debes elegir un plantel']
]);
}
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'apellidoPaterno' => ['required', 'string', 'max:255'],
'apellidoMaterno' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'telefono' => ['required', 'digits:10', 'unique:users,telefono'],
'password' => $this->passwordRules(),
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
])->validate();
if (User::where('email', $input['email'])
->orWhere('telefono', $input['telefono'])
->exists()) {
throw ValidationException::withMessages([
'email' => ['El correo o teléfono ya están registrados.']
]);
}
$user = User::create([
'name' => $input['name'],
'apellidoPaterno' => $input['apellidoPaterno'],
'apellidoMaterno' => $input['apellidoMaterno'],
'email' => $input['email'],
'telefono' => $input['telefono'],
'direccion' => "",
@@ -59,8 +58,6 @@ class CreateNewUser implements CreatesNewUsers
$prospecto->prospectos()->sync([$user->id]);
return $user;
}
}