By default, Laravel logs in the user immediately after registration and redirects them to the home page (usually '/home'). This provides a smooth experience where the user doesn't have to log in again.
The 'confirmed' rule automatically checks that the field has a matching field with '_confirmation' appended. So 'password' with 'confirmed' expects a 'password_confirmation' field.
public function register(Request $request) {
$request->validate([
'name' => 'required',
'email' => 'required|email|unique:users',
'password' => 'required|confirmed|min:8'
]);
$user = new User();
$user->name = $request->name;
$user->email = $request->email;
$user->password = bcrypt($request->password);
// Missing something here
return redirect('/home');
}The code creates a new User object and sets properties but never calls save(). Without calling $user->save(), the user is not stored in the database.
email_verified_at field on the user model immediately after registration but before the user clicks the verification link?Laravel sets email_verified_at only after the user clicks the verification link. Before that, it remains null.
The guest middleware redirects authenticated users away from routes meant only for guests, such as registration and login pages.