Broad Database Overview

High-level concepts: models, relationships, migrations, and request helpers

Major Entities (Models)

Key models power public websites and content features:

Public Website

  • PublicProfile: top-level site container (slug, branding)
  • PublicPage: per-profile pages (title, slug, menus)
  • PageSection/SectionTemplate/SectionVariable/SectionVariableValue

Content

  • Blog, Post, Comment, PostLike
  • Podcast, Episode
  • EventList, Event
  • Poll, PollOption, PollResponse
  • Media, MediaList, MediaListItem, Tag

Subscriptions & Tokens

  • Plan, PlanFeature, Subscription, SubscriptionPayment
  • TokenPackage, TokenPurchase, TokenUsageLog

Notifications & Analytics

  • NotificationSubscription, NotificationMessage
  • ProfileAnalytics, UserActivityLog

Relationships

Public Profiles ↔ Pages

  • PublicProfilePublicPage: many-to-many via public_profile_public_page pivot
  • Pivot fields: is_default, order; access via publicPages() / publicProfiles()
  • Convenience: defaultPublicPage() (profile) and ordered associations on both sides

Pages → Sections → Variables

  • PublicPage hasMany PageSection (sections(), activeSections())
  • PageSection belongsTo PublicPage, SectionType, SectionTemplate; optional backgroundMedia()
  • PageSection has polymorphic variableValues()SectionVariableValue via sectionable
  • SectionVariableValue belongsTo SectionVariable; exposes parsed_value for typed access

Profiles → ProfileSections

  • PublicProfile hasMany ProfileSection (sections(), activeSections())
  • SectionVariableValue can also reference profile sections (legacy/back-compat) and uses the same polymorphic pattern

Blogs, Posts, Comments, Likes

  • Blog hasMany Post; both support polymorphic comments() (commentable)
  • Post hasMany PostLike (likes()) and scopes (published(), featured())
  • Comment morphTo commentable; self-referencing parent() / replies(); hasMany CommentLike

Podcasts, Episodes, Taxonomy

  • Podcast hasMany Episode, Season, RssFeed, PodcastView
  • Many-to-many: contributors(), categories(), tags() with pivot tables
  • Polymorphic comments on Podcast via comments() / approvedComments()

Media & Playlists

  • MediaList hasMany MediaListItem (ordered playlists)
  • Media belongsToMany Tag via media_tags; supports derived relations (e.g., MediaClip)

Events & Notifications

  • EventList hasMany Event
  • PublicProfile hasMany NotificationSubscription; messages sent via NotificationMessage

Subscriptions & Plans

  • Plan hasMany PlanFeature
  • Subscription associates users to Plan with payments in SubscriptionPayment

Migrations Overview

Tables are created under database/migrations with timestamps. Notable groups:

  • Public pages & sections: public_pages, page_sections, section_types, section_templates, section_variables, section_variable_values
  • Content: blogs, posts, comments, post_likes; podcasts, episodes; events, event_lists
  • Media: media, media_lists, media_list_items, media_tags, tags
  • Engagement: polls, poll_options, poll_responses; surveys and related tables
  • Monetization: plans, plan_features, subscriptions, subscription_payments; token_* tables

Controllers (Selected)

Controllers orchestrate dashboard CRUD and public rendering:

  • Dashboard: Podcasts, Episodes, Transcriptions, Contributors, Tags, Studio
  • Public: PublicProfileController, PublicPageController
  • Media & Content: MediaController, BlogController, PostController, EventController
  • Engagement: PollController, SurveyController, NotificationController
  • Commerce: SubscriptionController, Admin controllers for plans/packages

Making Requests to the Server

Use global helpers from resources/views/layouts/app.blade.php:

GET: apiGet(url, options?)

POST: apiPost(url, data, options?)

PUT: apiPut(url, data, options?)

PATCH: apiPatch(url, data, options?)

DELETE: apiDelete(url, options?)

All send/expect JSON, include credentials, and accept extra headers via options.headers.

File uploads: apiFileUpload(url, FormData, { headers?, onProgress? }) with progress; or uploadFileAndCreateMedia(file, meta?, onProgress?) to create media via /api/media.

Useful Paths

  • Routes: routes/web.php
  • Models: app/Models/*
  • Controllers: app/Http/Controllers/*
  • Migrations: database/migrations/*
  • Public help: resources/views/public/help.blade.php