Customer Management
Customer Structure
Each customer record contains essential contact information:app/Models/Customer.php:14-20
Creating Customers
- Manual Creation
- Automatic (Walk-in)
Workers and admins create customers through the interface:See:
app/Http/Controllers/Worker/CustomerController.php:36-44Validation Rules
Fromapp/Http/Requests/StoreCustomerRequest.php:14-22:
| Field | Type | Rules |
|---|---|---|
name | string | Required, max 255 chars |
email | string | Required, valid email, max 255 |
phone | string | Optional, max 50 chars |
address | string | Optional, max 255 chars |
Customer Search
Find customers by name, email, or phone:app/Http/Controllers/Worker/CustomerController.php:21-27
Customer Display Name
Billing documents show appropriate customer names:app/Models/BillingDocument.php:63-70
Equipment Management
Equipment Structure
Equipment records track devices requiring service:app/Models/Equipment.php:16-23
Creating Equipment
- Manual Creation
- Automatic (Walk-in)
Link equipment to existing customers:See:
app/Http/Controllers/Worker/EquipmentController.php:44-58Validation Rules
Fromapp/Http/Requests/StoreEquipmentRequest.php:14-23:
| Field | Type | Rules |
|---|---|---|
customer_id | integer | Required, must exist |
type | string | Required, max 100 chars |
brand | string | Required, max 100 chars |
model | string | Optional, max 150 chars |
serial_number | string | Optional, max 150 chars |
Equipment Search
By Brand
By Model
By Type
app/Http/Controllers/Worker/EquipmentController.php:25-34
Service History
Customer Service History
Customers maintain relationships with all their service orders:Equipment Service History
Equipment tracks all repairs performed:app/Models/Equipment.php:35-38
Billing History
Customers link to all billing documents:app/Models/Customer.php:37-40
Relations
Customer Relations
- Company → Customers (one-to-many)
- Customer → Equipment (one-to-many)
- Customer → Orders (one-to-many)
- Customer → Billing Documents (one-to-many)
app/Models/Customer.php:22-40
Equipment Relations
- Company → Equipment (one-to-many)
- Customer → Equipment (one-to-many)
- Equipment → Orders (one-to-many)
app/Models/Equipment.php:25-38
Business Rules
Cross-Company Restrictions
Customer Isolation
Customer Isolation
Users can only view and manage customers from their own company:Developers can access all companies.
Equipment-Customer Validation
Equipment-Customer Validation
When creating equipment, customer must belong to user’s company:
Order Creation Validation
Order Creation Validation
Customer and equipment must belong to same company:See:
app/Services/OrderCreationService.php:28-30Data Display
Customer List View
Typical customer listing:Equipment with Customer
Show equipment with owner information:app/Http/Controllers/Worker/EquipmentController.php:16-22
Order Context Loading
When displaying orders, load related customer and equipment:app/Http/Controllers/Worker/OrderController.php:25-27