validate([ 'rz_username' => ['required', Rule::unique('users', 'rz_username')], 'full_name' => ['required', 'min:3'], 'organisation_unit' => 'required', 'password' => 'required|min:6' //'password' => 'required|confirmed|min:6' ]); // Hash Password $formFields['hashed_password'] = bcrypt($formFields['password']); $user = User::create($formFields); auth()->login($user); return redirect('/home'); } public function login() { return view('users.login'); } public function authenticate(Request $request) { $formFields = $request->validate([ 'rz_username' => 'required', 'password' => 'required' ]); if (auth()->attempt($formFields)) { $request->session()->regenerate(); return redirect('/home'); } } }