TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Henry4ndrew/saborGestion/llms.txt
Use this file to discover all available pages before exploring further.
usuarios resource is a full CRUD interface for managing every account that can log in to SaborGestion. Access is restricted to the admin role — any other authenticated user who requests a route under /usuarios receives a 403 response.
All routes under
/usuarios are protected by the role:admin middleware applied in UsuarioController::__construct(). This is in addition to the outer auth middleware that guards all dashboard routes.User fields
Theusers table is created by two migrations that run in sequence.
| Column | Type | Notes |
|---|---|---|
id | bigIncrements | Primary key |
name | string | Required |
email | string | Unique |
email_verified_at | timestamp | Nullable |
password | string | Stored as bcrypt hash |
remember_token | string(100) | Nullable |
role | enum | admin, mesero, cocinero, cajero — defaults to mesero |
created_at / updated_at | timestamps | Automatic |
role column is added by 2026_03_20_235344_add_role_to_users_table.php:
Route map
All routes are registered as a Laravel resource under theauth middleware group:
| Verb | URI | Controller method | Description |
|---|---|---|---|
GET | /usuarios | index | List all users |
GET | /usuarios/create | create | Show creation form |
POST | /usuarios | store | Persist a new user |
GET | /usuarios/{usuario}/edit | edit | Show edit form |
PUT | /usuarios/{usuario} | update | Persist changes |
DELETE | /usuarios/{usuario} | destroy | Delete a user |
The
show route (GET /usuarios/{usuario}) is registered by the resource macro but does not have a dedicated view in this project. The index and edit views cover read use cases.Validation rules
Creating a user — store
Updating a user — update
The
password field is not present in the update validation rules. If you submit a non-empty password value, the controller checks $request->filled('password') and hashes it with Hash::make. Leaving the field blank leaves the existing password unchanged.Password hashing
Passwords are never stored in plain text. Thestore method hashes immediately after validation:
User model also declares password in its casts array as 'hashed', which provides an additional safety layer:
Creating users via Tinker
You can seed initial accounts from the command line without using the web form. This is useful during first-time setup when no admin account exists yet.The
User model declares 'password' => 'hashed' in its casts array, so User::create() automatically bcrypt-hashes the password — you do not need to call Hash::make manually in Tinker. The UsuarioController::store method calls Hash::make explicitly only because it works with the raw validated array before passing it to User::create.CRUD walkthrough
Open the users list
Navigate to
/usuarios. You see a table showing every user’s name, email, and role (color-coded badge: red for admin, blue for mesero, green for cocinero, yellow for cajero).Click Nuevo Usuario
The button in the top-right corner links to
/usuarios/create. Fill in the name, email, password (minimum 8 characters), and select a role from the dropdown.Submit the form
A
POST request is sent to /usuarios. The controller validates, hashes the password, and calls User::create. On success, you are redirected back to /usuarios with the flash message “Usuario creado exitosamente”.Edit a user
Click the edit icon next to any row. The form at
/usuarios/{usuario}/edit pre-fills name, email, and role. Leave the password field blank to keep the current password.User model
Roles & permissions
See which routes each role can access and how RoleMiddleware enforces access
Middleware reference
Detailed explanation of RoleMiddleware and how it integrates with the router