Register

A new user can be added by using the Register button.

The user must provide the name, a valid email and a password to create a new account.

The App\Http\Controllers\RegisterController handles the registration of a new user.


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

Also you shouldn't worry that a new user might enter wrong data in the inputs, validation rules were added to prevent this from hapenning (see App\Http\Requests\RegisterController). If a user is already registered but tries registering again with the same email it will show an error, the email must be unique. Another condition is for the password's length to be of minimum 8 characters.


                    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:8', 'confirmed'],
                        ]);
                    }