Sign Up

You can register as a user by filling in the name, email, role and password for your account.


For your role you can choose between the Admin, Creator and Member. It is important to know that an admin user has access to all the pages and actions, can delete, add and edit another users, other roles, items, tags or categories; a creator user has acces to category, tag and item managemen, but can not add, edit or delete other users; a member user has access to the item management but can not take any action.You can do this by accessing the sign up page from the Sign Up button in the top navbar or by clicking the Sign Up button from the bottom of the log in form. Another simple way is adding /sign-up in the url.

The App\Http\Livewire\Auth\Register handles the registration of a new user.

              
                public function register() {
                    $this->validate();
                    $user = User::create([
                        'name' => $this->name,
                        'email' => $this->email,
                        'role_id' => $this->role_id,
                        'password' => Hash::make($this->password)
                    ]);
                    auth()->login($user);
                    return redirect('/dashboard-default');
                }
              
            

The data entered by the user are checked before being added in the database and creating an account.

              
                public function rules() {
                    return  [
                        'name' => 'required|min:2',
                        'email' => 'required|email|unique:users',
                        'password' => 'required|min:6',
                        'role_id' => ['required', Rule::in(collect(DB::table('roles')->pluck('id')))]
                    ];
                }