User Management

-
Pro Component

The Admin user has access to a users management table page.


The user management can be accessed by clicking User Management from the Laravel Examples section of the sidebar. This page is available for users with the Admin role and the user is able to add, edit and delete other users. For adding a new user you can press the + Add User button. If you would like to edit or delete an user you can click on the Action column. It is also possible to sort the fields or to search in the fields.

The policy which authorizes the user to access the user management pages is implemented in App\Policies\UserPolicy.php

Once you add more users, the list will grow and for every user you will have edit and delete options

App/Http/Livewire/LaravelExamples/UserManagement/Create.php takes care of data validation and creating the new user. See store method example bellow:

              
                public function store(){

                  $this->validate();


                  User::create([
                      'email' => $this->email,
                      'name' => $this->name,
                      'password' => $this->password,
                      'picture' => $this->picture->store('profile', 'public'),
                      'role_id' => $this->role_id,
                  ]);

                  return redirect(route('user-management'))->with('status','User successfully created.');
              }