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); Log::info('User successfully created'); 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(); Log::info('User authenticated successfully'); return redirect('/home'); } } public function logout(Request $request) { auth()->logout(); $request->session()->invalidate(); $request->session()->regenerateToken(); Log::info('User successfully logged out'); return redirect('/home'); } }