Skip to content

Data Models Documentation

Generated: 2025-11-16

Overview

Flowcode uses 176 Eloquent models organized in app/Models/. This document categorizes and describes the core domain models.

Domain Model Categories

1. Core Business Entities

Organization & Tenancy

  • Organisation - Root entity for multi-tenancy
  • OrganisationTenant - Spatie multi-tenancy integration
  • OrganisationUser - User-org membership pivot
  • OrganisationRole - Custom roles per organization
  • OrganisationPermission - Org-level permissions
  • OrganisationRoleUser - Role assignments
  • OrganisationRoleNode - Organogram node relationships

User Management

  • User - Core user model
  • Permission - System permissions
  • Role - Global roles
  • DivisionUser - User-division mapping
  • DepartmentUser - User-department mapping
  • Division - Org subdivisions
  • Department - Org departments

Catalogue System

  • Catalogue - Business catalogues (versioned collections)
  • CatalogueModule - Module types for catalogues
  • CatalogueCatalogueModule - Catalogue-module pivot
  • CatalogueProgress - User progress in catalogue
  • OrganisationCatalogue - Org-catalogue assignments
  • OrganisationCatalogueModule - Module assignments
  • OrganisationCatalogueModuleUser - User module access

Element & Field System

  • Element - Units within catalogues
  • ElementTab - Tabs organizing element fields
  • ElementProgress - User progress on elements
  • ElementAnalysis - AI-generated analysis
  • ElementOverview - AI-generated overviews
  • ElementNotice - Element notifications
  • ElementGroup - Grouping elements
  • ElementArchive - Archived element versions
  • ElementUpload - File attachments
  • ElementFeedback - Feedback on elements

  • Field - Data fields within elements

  • FieldProgress - User field completion tracking
  • FieldChildren - Nested/repeater field children

OPTT (Objectives, Projects, Tasks, Targets)

  • Objective - Strategic objectives
  • Project - Projects under objectives
  • Task - Tasks under projects
  • Target - Measurable targets
  • LinkedOptt - Cross-OPTT relationships
  • OpttAttachment - File attachments for OPTT items
  • Blocker - Task blockers
  • Milestone - Project milestones

2. Session & Event Management

  • EngaugeSession - Scheduled sessions/events
  • EngaugeSessionProgress - Attendance tracking
  • SessionAttachment (inferred) - Session files
  • Clash - Session scheduling conflicts
  • PersonalLink - User session links
  • DeliveryLocationUserRole - Location-based roles

3. Content & Knowledge

Knowledge Resources

  • Knowledgebase - Knowledge bases
  • KnowledgebaseCategory - KB categories
  • Article - KB articles
  • ArticleFeedback - Article ratings/feedback
  • Glossary - Term definitions
  • GlossaryItem - Individual glossary terms

Learning

  • Course - Training courses
  • CourseUnit - Course sections
  • Lesson - Individual lessons
  • LessonAttachment - Lesson materials

Media & Assets

  • Graphic - Visual graphics
  • GraphicGroup - Grouped graphics
  • GraphicGroupGraphic - Group membership
  • GraphicGroupUser - User access to groups
  • GraphicArchive - Archived graphics
  • Podcast - Audio content
  • BizEntertainment - Entertainment content

4. Compliance & Indicators

  • IndicatorTask - Compliance tasks
  • IndicatorSubmission - Task submissions
  • IndicatorSubmissionAttachment - Supporting docs
  • IndicatorSubmissionReview - Review records
  • IndicatorReviewTask - Review assignments
  • IndicatorCompliance - Compliance definitions
  • IndicatorComplianceProgramme - Programme compliance
  • IndicatorComplianceProgrammeMonth - Monthly tracking
  • IndicatorSuccess - Success metrics
  • IndicatorSuccessProgramme - Programme success
  • IndicatorSuccessProgrammeMonth - Monthly metrics

5. System & Configuration

  • GlobalSetting - System-wide settings
  • Feature - Feature flags
  • AiPrompt - AI prompt templates
  • OpenAiUsageLog - AI usage tracking
  • EmailTemplate - Email templates
  • InAppTemplate - In-app notification templates
  • AdminNotification - Admin alerts
  • ActivityLog - Spatie activity logging
  • ImportLog - Data import history
  • Import - Import definitions

6. Support Entities

  • Comment - Generic comments (polymorphic)
  • Module - System modules
  • MenuBuilder - Dynamic menu configuration
  • Folder - File organization
  • AttachmentType - File type definitions
  • AttachmentPermission - File access control
  • EnergyPoint - Gamification points
  • Partner - Partner organizations
  • LicenceGroup - License management
  • Committee - Organizational committees
  • Budget - Financial tracking

7. Programme & Seat Management

  • Programme (inferred from patterns)
  • OrganisationProgrammeSeat - Programme seat allocation
  • OrganisationManagementSeat - Management seats
  • OrganisationOpttSeat - OPTT feature seats
  • IspSeat - ISP-specific seats
  • ExitingEntrepreneurs - Programme exits

Key Relationships

Multi-Tenancy Architecture

Tenant (Spatie)
  └── Organisation
        ├── Users (many-to-many via OrganisationUser)
        ├── Catalogues (via OrganisationCatalogue)
        ├── Roles (OrganisationRole)
        ├── Departments & Divisions
        └── OPTT Entities

Catalogue Hierarchy

Catalogue
  └── CatalogueModule
        └── Element
              ├── ElementTab (primer, strategy, custom, etc.)
              │     └── Field
              │           └── FieldProgress (per user)
              ├── ElementNotice
              ├── ElementUpload
              └── Graphic

User Progress Tracking

User
  ├── CatalogueProgress
  ├── ElementProgress
  ├── FieldProgress (per field per user)
  ├── IndicatorTask assignments
  └── Session attendance

OPTT Structure

Objective (annual/strategic)
  └── Project (implementation)
        └── Task (actionable items)
              └── Target (measurable KPIs)

Database Considerations

  • 396 migrations indicate a mature, evolved schema
  • Multi-tenant isolation via Spatie package
  • Extensive pivot tables for many-to-many relationships
  • Progress tracking at multiple granularities
  • Soft deletes and archiving patterns
  • Polymorphic relationships (comments, attachments)
  • Audit logging with Spatie Activity Log

Model Traits & Patterns

Based on Laravel conventions and codebase structure: - HasFactory - All models likely have factories - SoftDeletes - Archive/restore functionality - BelongsToTenant - Spatie multi-tenancy - LogsActivity - Audit trail - HasRoles - Role-based access - Custom collections (ObjectiveCollection, ProjectCollection)