Skip to main content
Eventify gives administrators full control over the user accounts registered on the platform. From the /dashboard/admin/users section, an admin can inspect every account in the system, onboard new users by filling in their credentials and assigning a role, update any existing account’s details (including resetting their password), and permanently remove accounts that are no longer needed. All of this is handled by the UserController, which sits behind both the auth and role:admin middleware layers.

Access

User management routes are nested inside the /dashboard/admin prefix group, which applies middleware('role:admin') on top of the outer ['auth', 'role:admin|user'] guard. Only accounts whose role label is admin can reach any of the endpoints below — all others receive a 403 Unauthorized response.

Route Reference

Listing Users

GET /dashboard/admin/users fetches every user record in the database and eager-loads their associated Role to avoid N+1 queries in the management view.
Each row in the resulting view has direct access to $user->role->name and $user->role->label without triggering additional queries.

Creating a User

1

Open the creation form

Navigate to GET /dashboard/admin/users/create. The controller loads all available roles from the database and passes them to the view so the admin can pick one from a drop-down.
2

Submit the form

The form posts to POST /dashboard/admin/users. The store method reads the four required fields, hashes the plain-text password using Hash::make(), and saves the record.
3

Confirm the redirect

On success the admin is redirected back to the user list at users.index.

Required Fields

The role_id column defaults to 2 (the user role) at the database level, but the creation form always requires the admin to make an explicit selection, so the default is a safety net rather than an intended workflow.

Editing a User

1

Open the edit form

Navigate to GET /dashboard/admin/users/{id}/edit. The controller fetches the target user by primary key and loads all roles for the role selector.
2

Submit the changes

The form sends a PUT request to /dashboard/admin/users/{id}. All four fields may be changed. The password field is optional on edit — if it is left blank the existing hashed password is preserved unchanged.
Leave the password field empty when editing a user if you only want to update their name, email, or role. The conditional $request->filled('password') check ensures the stored hash is never overwritten with an empty value.

Deleting a User

Sending a DELETE request to /dashboard/admin/users/{id} permanently removes the user record from the database. The controller locates the user by ID, calls delete(), then redirects back to the user list.
Deletion is immediate and irreversible through the UI. Although the users table schema includes a deleted_at column via softDeletes(), the User model does not use the SoftDeletes trait, so $user->delete() performs a hard delete and the record cannot be recovered.

User Model Reference

The User model’s $fillable array and its relationships are shown below for reference.