OPBX Data Models
This section provides comprehensive documentation for all data models used in the OPBX (Open Source Business PBX) Laravel backend.
Overview
OPBX uses a multi-tenant architecture where all data is scoped to an Organization. The data models are organized into the following categories:
Model Categories
Core Models
- User - System users with role-based access control
- Organization - Multi-tenant organization container
- Extension - PBX extensions (the central entity for call routing)
PBX Resource Models
- RingGroup - Call distribution groups
- ConferenceRoom - Multi-party conference rooms
- DidNumber - Direct Inward Dialing (phone numbers)
Call Management Models
- CallLog - Call activity logs
- CallDetailRecord - Billing and audit records
- Recording - Call recordings
AI Feature Models
- AiAssistant - AI assistant configuration
- AiAssistantLoadBalancer - AI load balancing
Configuration Models
- BusinessHoursSchedule - Business hours
- IvrMenu - Interactive Voice Response menus
- CloudonixSettings - Cloudonix integration
- CallNotificationsSettings - Webhook notifications
Security Models
- InboundBlacklist - Blocked callers
- OutboundWhitelist - Outbound dialing restrictions
Enums
All enums are documented in the Enums section:
- UserRole - owner, pbx_admin, pbx_user, reporter
- UserStatus - active, inactive
- ExtensionType - user, conference, ring_group, ivr, ai_assistant, etc.
- RingGroupStrategy - simultaneous, round_robin, priority, weighted, memory
- And more...
Entity Relationships
See the Entity Relationships page for a complete diagram of model relationships.
Common Patterns
Multi-Tenancy
All models use the OrganizationScope global scope to ensure data isolation:
#[ScopedBy([OrganizationScope::class])]
class Model extends Model
{
// Automatically scoped by organization_id
}
Soft Deletes
Most models support soft deletes for data recovery.
Audit Fields
Models track creation and update information via relationships to the User model.
JSON Configuration
Many models use JSON columns for flexible configuration storage.