Domain Models
Miranda uses UUID primary keys on all models via the HasUuid concern. All models belong to a Foundation scope, ensuring multi-tenant data isolation.
Foundation & Site
Section titled “Foundation & Site”Foundation
Section titled “Foundation”The root tenant model. Every other model in the system belongs to a foundation.
| Field | Type | Description |
|---|---|---|
brand_colors | array | Custom brand color palette |
settings | array | Foundation-wide configuration |
vocabulary_overrides | array | Custom terminology (e.g., “donor” → “supporter”) |
enabled_modules | array | Feature flags for active modules |
directory_listed | boolean | Whether foundation appears in the public directory |
safety_mode | boolean | Restricts destructive operations when enabled |
trial_ends_at | datetime | Trial expiration (null = no trial) |
frozen_at | datetime | Account freeze timestamp (null = active) |
Key relationships: users, donationPages, donations, scholarships, donorLinks, newsletterSubscriptions, roles, site
Methods:
isFrozen()— Returns true if the account is frozenisTrialing()— Returns true/false/null (null = never trialed)
FoundationSite
Section titled “FoundationSite”Public-facing website configuration for a foundation. One-to-one with Foundation.
| Field | Type | Description |
|---|---|---|
custom_fonts | array | Font configuration for the public site |
Relationships: foundation, pages, enabledPages (filtered + ordered by sort_order)
FoundationPage
Section titled “FoundationPage”Individual pages within a foundation’s public site.
| Field | Type | Description |
|---|---|---|
blocks | array | Page content as a block structure |
enabled | boolean | Whether the page is published |
Relationships: site (FoundationSite)
Contacts & Relationships
Section titled “Contacts & Relationships”Contact
Section titled “Contact”The central person record. A contact can have multiple relationship types (donor, applicant, subscriber, general) with a single foundation.
| Field | Type | Description |
|---|---|---|
first_name | string | First name |
last_name | string | Last name |
address | array | Structured address data |
communication_preferences | array | Opt-in/out preferences per channel |
first_contact_at | datetime | When this contact was first added |
Key relationships: foundation, relationships, tags (many-to-many via contact_tag), activities, notes, donations
Computed attributes:
full_name— Concatenated first + last namerelationship_types— Array of active relationship type values (appended by default)
Methods:
hasRelationship(ContactRelationshipType $type)— Check if a relationship existsaddRelationship(ContactRelationshipType $type, ?array $metadata)— Create or find a relationship
ContactRelationship
Section titled “ContactRelationship”Join record that assigns a relationship type to a contact within a foundation.
| Field | Type | Description |
|---|---|---|
type | ContactRelationshipType | The relationship type enum |
metadata | array | Additional context for this relationship |
assigned_at | datetime | When the relationship was established |
Freeform labels applied to contacts for organization and segmentation.
Relationships: foundation, contacts (many-to-many via contact_tag with foundation_id pivot)
SavedSegment
Section titled “SavedSegment”Reusable filter criteria for querying contacts.
| Field | Type | Description |
|---|---|---|
criteria | array | Filter rules for building the segment query |
Activity
Section titled “Activity”Timeline events recorded against a contact.
| Field | Type | Description |
|---|---|---|
type | ActivityType | The activity type enum |
metadata | array | Event-specific data |
Free-text notes attached to a contact by a user.
Relationships: contact, user, foundation
Donations & Donor Profiles
Section titled “Donations & Donor Profiles”Donation
Section titled “Donation”A single financial transaction.
| Field | Type | Description |
|---|---|---|
amount | integer | Amount in cents |
platform_fee | integer | Platform fee in cents |
donor_covered_fees | boolean | Whether the donor opted to cover processing fees |
type | DonationType | one_time or recurring |
status | DonationStatus | pending, succeeded, failed, refunded |
recurring_interval | RecurringInterval | monthly, quarterly, annual (nullable) |
metadata | array | Stripe metadata and other details |
donated_at | datetime | When the donation was made |
Relationships: foundation, contact, donationPage
DonationPage
Section titled “DonationPage”A configurable page for accepting donations. Supports multiple page types with type-specific configuration.
| Field | Type | Description |
|---|---|---|
suggested_amounts | array | Preset donation amount options |
allow_custom_amount | boolean | Whether donors can enter a custom amount |
allow_recurring | boolean | Whether recurring donations are enabled |
allow_donor_covers_fees | boolean | Whether the fee-coverage option is shown |
status | DonationPageStatus | draft, published, offline |
type | DonationPageType | Page type (general, scholarship, campaign, memorial, emergency, sustainer) |
type_config | array | Type-specific configuration (see Enums reference) |
Relationships: foundation, donations, scholarship (via type_config->scholarship_id)
DonorProfile
Section titled “DonorProfile”A donor identity that can span multiple foundations. Tracks lifetime giving across the platform.
| Field | Type | Description |
|---|---|---|
lifetime_given | decimal | Total giving across all foundations |
first_gift_at | datetime | First donation timestamp |
last_gift_at | datetime | Most recent donation timestamp |
Relationships: foundationLinks, newsletterSubscriptions
DonorFoundationLink
Section titled “DonorFoundationLink”Links a DonorProfile to a specific Foundation, with per-foundation giving stats.
| Field | Type | Description |
|---|---|---|
newsletter_subscribed | boolean | Newsletter opt-in for this foundation |
total_given | decimal | Total given to this foundation |
first_gift_at | datetime | First gift to this foundation |
last_gift_at | datetime | Most recent gift to this foundation |
Relationships: donorProfile, foundation, contact
NewsletterSubscription
Section titled “NewsletterSubscription”Tracks newsletter subscription state per donor per foundation.
| Field | Type | Description |
|---|---|---|
subscribed | boolean | Current subscription status |
Campaigns & Communications
Section titled “Campaigns & Communications”Campaign
Section titled “Campaign”A one-time broadcast message sent to a segment of contacts.
| Field | Type | Description |
|---|---|---|
channel | CampaignChannel | email or sms |
status | CampaignStatus | draft, scheduled, sending, sent |
segment_criteria | array | Contact filter criteria for targeting |
stats | array | Delivery/open/click statistics |
scheduled_at | datetime | When the campaign is scheduled to send |
sent_at | datetime | When the campaign was actually sent |
Relationships: foundation, communicationLogs
CommunicationLog
Section titled “CommunicationLog”Individual message delivery record.
| Field | Type | Description |
|---|---|---|
channel | CampaignChannel | email or sms |
direction | CommunicationDirection | outbound or inbound |
status | CommunicationStatus | Delivery status (sent, delivered, opened, clicked, bounced, failed) |
Relationships: contact, campaign
MessageTemplate
Section titled “MessageTemplate”Reusable message templates with merge field support.
| Field | Type | Description |
|---|---|---|
channel | CampaignChannel | email or sms |
merge_fields | array | Available merge fields and their mappings |
Sequence
Section titled “Sequence”An automated multi-step communication flow triggered by a specific event.
| Field | Type | Description |
|---|---|---|
trigger | SequenceTrigger | What event starts the sequence |
Relationships: foundation, steps (ordered by position), enrollments
SequenceStep
Section titled “SequenceStep”A single step within a sequence.
| Field | Type | Description |
|---|---|---|
channel | CampaignChannel | email or sms |
position | integer | Step order within the sequence |
delay_hours | integer | Hours to wait after previous step |
SequenceEnrollment
Section titled “SequenceEnrollment”Tracks a contact’s progress through a sequence.
| Field | Type | Description |
|---|---|---|
next_step_at | datetime | When the next step should execute |
enrolled_at | datetime | When the contact entered the sequence |
completed_at | datetime | When the contact finished (null = in progress) |
Relationships: sequence, contact, currentStep
Scholarships & Disbursements
Section titled “Scholarships & Disbursements”Scholarship
Section titled “Scholarship”A scholarship program with configurable application form and award limits.
| Field | Type | Description |
|---|---|---|
amount | integer | Award amount in cents |
max_awards | integer | Maximum number of awards |
form_fields | array | Custom application form field definitions |
deadline | date | Application deadline |
status | ScholarshipStatus | Lifecycle status |
Relationships: foundation, applications, disbursements
ScholarshipApplication
Section titled “ScholarshipApplication”An individual application submitted for a scholarship.
| Field | Type | Description |
|---|---|---|
responses | array | Applicant’s form field responses |
attachments | array | Uploaded file references |
stage | ApplicationStage | new, under_review, accepted, declined |
source | ApplicationSource | form, api, webhook |
submitted_at | datetime | Submission timestamp |
Relationships: foundation, scholarship, contact
Disbursement
Section titled “Disbursement”A financial disbursement (scholarship award, grant, or operational expense).
| Field | Type | Description |
|---|---|---|
amount | integer | Amount in cents |
category | DisbursementCategory | scholarship, grant, operational, program, admin |
disbursed_at | datetime | When the disbursement was made |
Relationships: foundation, contact, scholarship
Users & Roles
Section titled “Users & Roles”An authenticated user belonging to a foundation.
| Field | Type | Description |
|---|---|---|
role | UserRole | Platform-level role (owner, admin, member, readonly) |
email_verified_at | datetime | Email verification timestamp |
Relationships: foundation, teamRole (Role model for granular permissions)
Foundation-scoped role with custom permissions.
| Field | Type | Description |
|---|---|---|
permissions | array | Granular permission flags |
is_default | boolean | Whether this is the default role for new team members |
TeamInvite
Section titled “TeamInvite”Pending invitation to join a foundation’s team.
| Field | Type | Description |
|---|---|---|
accepted_at | datetime | When the invite was accepted (null = pending) |
expires_at | datetime | Invitation expiration |
Methods:
isExpired()— Returns true if the invitation has expiredisAccepted()— Returns true if the invitation has been accepted