Register

A new account can be created by a user with the help of the Create account button from the login page or the Register button from the top navabar. The user must provide the name, email and a password.

The App\Http\Controllers\RegisterController handles the user's registration.


protected function create(array $data)
{
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => Hash::make($data['password']),
    ]);
}     
                    

The data introduced by the user is validated because the account needs a valid email address and the password and password confirmation to match.


protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => ['required', 'string', 'max:255'],
        'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        'password' => ['required', 'string', 'min:6', 'confirmed'],
    ]);
}