validate([ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:' . User::class], 'password' => ['required', 'confirmed', Rules\Password::defaults()], ]); $user = User::create([ 'name' => $request->name, 'email' => $request->email, 'department_id' => null, 'password' => Hash::make($request->password), ]); event(new Registered($user)); Auth::login($user); return redirect(route('dashboard', absolute: false)); } }