Overview
BeanQuick implements a secure three-stage business registration process that ensures only legitimate businesses can join the platform. The workflow involves initial signup, admin review, and email-based account activation.Registration Workflow
Stage 1: Business Signup
Businesses submit a registration request through the public signup form. Endpoint:POST /api/solicitud-empresa
Required Fields:
| Field | Type | Validation | Description |
|---|---|---|---|
nombre | string | required, max:255 | Business name |
correo | string | required, email, unique | Business email (must be unique) |
nit | string | nullable, max:50 | Tax identification number |
telefono | string | nullable, max:50 | Contact phone number |
direccion | string | nullable, max:255 | Physical address |
descripcion | text | nullable | Business description |
logo | file | nullable, image, max:2MB | Business logo (jpeg, png, jpg, webp) |
foto_local | file | nullable, image, max:4MB | Store photo (jpeg, png, jpg, webp) |
Image Storage: Uploaded images are stored temporarily in
storage/app/public/solicitudes/ until the business is approved.- Logos:
solicitudes/logos/ - Store photos:
solicitudes/locales/
Stage 2: Admin Review
Administrators review pending applications from the admin dashboard.View Pending Applications
Endpoint:GET /api/admin/dashboard
Approve Application
Endpoint:POST /api/admin/solicitudes/{id}/aprobar
When approved, the system:
- Generates a secure 60-character activation token
- Updates the application status to
'aprobado' - Sends an activation email with a unique link
ActivacionEmpresaMail
Success Response:
Reject Application
Endpoint:POST /api/admin/solicitudes/{id}/rechazar
Stage 3: Account Activation
The business owner receives the activation email and completes account setup.Validate Activation Token
Endpoint:GET /api/empresa/activar/{token}
Complete Activation
Endpoint:POST /api/empresa/activar/{token}
Required Fields:
| Field | Validation | Description |
|---|---|---|
password | required, confirmed, min:8 | Account password |
password_confirmation | required, same as password | Password confirmation |
Move Images to Permanent Storage
- Logo:
solicitudes/logos/→empresas/logos/ - Store photo:
solicitudes/locales/→empresas/locales/
Database Models
SolicitudEmpresa Model
Table:solicitudes_empresas
Fillable Fields:
'pendiente'- Awaiting admin review (default)'aprobado'- Approved, activation email sent'rechazado'- Rejected by admin'completada'- Account activated successfully
logo_url- Full URL to logo imagefoto_local_url- Full URL to store photo
Empresa Model
Table:empresas
Fillable Fields:
usuario()- belongsTo Userproductos()- hasMany Productopedidos()- hasMany Pedido
logo_url- Full URL to logofoto_local_url- Full URL to store photo
Security Features
Token-Based Activation
Token-Based Activation
- 60-character random string generated using
Str::random(60) - Stored in database, validated on activation
- Single-use token (nullified after activation)
- Only valid for approved applications
Email Uniqueness
Email Uniqueness
- Email must be unique in
solicitudes_empresastable - Prevents duplicate applications
- Additional check during activation to prevent race conditions
Transaction Safety
Transaction Safety
- Account creation wrapped in database transaction
- Rollback on any error during:
- User creation
- Image file operations
- Business profile creation
- Ensures data consistency
File Upload Validation
File Upload Validation
- Validates file types (jpeg, png, jpg, webp)
- Logo max size: 2MB
- Store photo max size: 4MB
- Stored in
publicdisk with organized folder structure
Error Handling
Common Errors
| Error | HTTP Code | Reason |
|---|---|---|
| ”El enlace de activación no es válido o ya fue usado” | 404 | Invalid token or already activated |
| ”Ya existe una cuenta con este correo” | 422 | Email already registered |
| ”Laravel no detecta el archivo logo” | 400 | Missing logo file in request |
| ”Solicitud aprobada pero hubo un error al enviar el correo” | 500 | Email sending failed (approval successful) |
User Journey
Best Practices
Form Validation
Always validate file uploads on the frontend before submission to improve UX and reduce server load.
Token Security
Never expose activation tokens in logs or error messages. Use secure HTTPS in production.
Email Delivery
Implement retry logic for failed email deliveries. Log all email sending attempts for debugging.
Image Optimization
Compress and resize images on the frontend before upload to reduce storage costs and improve load times.
Implementation Example
Frontend Registration Form (React)
Related Features
Product Management
Learn how businesses manage their product catalog after registration
Order Management
Understand how businesses receive and process customer orders