Skip to main content

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

Call Management Models

AI Feature Models

Configuration Models

Security Models

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.