Role Overview
Customer
Browse products, place orders, and manage purchases
Business
Manage inventory, fulfill orders, and track sales
Admin
Approve businesses, manage users, and oversee platform
Role Assignment
Therol field in the User model determines user permissions:
User.php:18
The role is set during registration and determines which API routes and features the user can access.
Customer Role (cliente)
Customers are the end-users who browse and purchase products from businesses on the platform.
Permissions
Shopping & Orders
Shopping & Orders
- Browse all active businesses and their products
- Add products to cart from a single business per order
- Place orders with pickup time selection
- View order history and track order status
- Cancel pending orders before payment
Cart Management
Cart Management
- Add/remove products from cart
- Update product quantities
- Empty entire cart
- View cart total and item details
Reviews & Ratings
Reviews & Ratings
- Rate and review products after purchase
- Edit or delete own reviews
- View all reviews on products
Profile
Profile
- Update profile information (name, email)
- Change password
- View purchase history
Key API Routes
Model Relationships
User.php:37-43
Customers can only order from one business at a time. The cart is tied to a specific business via
empresa_id.Business Role (empresa)
Businesses are registered vendors who sell products through the platform.
Permissions
Product Management
Product Management
- Create, read, update, and delete products
- Set prices, stock levels, and availability
- Upload product images
- Assign products to categories
Order Fulfillment
Order Fulfillment
- View incoming paid orders
- Update order status (Preparando → Listo → Entregado)
- Cannot modify unpaid orders
- View order details and customer information
Business Profile
Business Profile
- Update business information (name, NIT, address, phone)
- Upload/change logo and storefront photo
- Set business description
- Toggle open/closed status
Analytics
Analytics
- View sales dashboard with metrics
- See customer reviews and ratings
- Download PDF sales reports
- Track order history
Key API Routes
Model Structure
Each business is linked to a user account:Empresa.php:15-25
Admin Role (admin)
Administrators oversee the entire platform, manage user accounts, and approve new business registrations.
Permissions
Business Approvals
Business Approvals
- View all pending business applications
- Approve or reject business registrations
- Send activation emails to approved businesses
- Manage business accounts (edit, delete)
User Management
User Management
- View all users (customers and admins)
- Edit user details (name, email, role)
- Reset user passwords
- Delete user accounts
- Cannot delete own admin account
Category Management
Category Management
- Create new product categories
- Delete existing categories
- Categories must have unique names
Platform Overview
Platform Overview
- View all orders across businesses
- Monitor platform activity
- Access complete user, business, and order lists
Key API Routes
Dashboard Response
AdminController.php:24-35
The admin dashboard provides a comprehensive view of all platform activity, including users, businesses, orders, and pending applications.
Role-Based Middleware
All protected routes use Laravel Sanctum authentication:api.php:63
Role Comparison
| Feature | Customer | Business | Admin |
|---|---|---|---|
| Browse Products | ✓ | ✓ | ✓ |
| Place Orders | ✓ | ✗ | ✗ |
| Manage Inventory | ✗ | ✓ | ✗ |
| Fulfill Orders | ✗ | ✓ | ✗ |
| Approve Businesses | ✗ | ✗ | ✓ |
| Manage Users | ✗ | ✗ | ✓ |
| View Analytics | Own orders | Own business | Platform-wide |
Security Notes
Best Practices
- Roles are assigned at registration and should not be changed arbitrarily
- Business accounts require admin approval before activation
- Admins cannot delete their own accounts to prevent lockout
- All routes require authentication via Sanctum tokens
- Role validation should be implemented in controller logic
Next Steps
Business Workflow
Learn how businesses register and get approved
Order Lifecycle
Understand order states and transitions