Zum Hauptinhalt springen

Models Übersicht

Postbox verwendet 79 Eloquent Models, verteilt auf 7 Domänen. Zusätzlich existieren 3 Tabellen ohne dediziertes Model (dashboard_leaderboard_snapshots, dashboard_global_snapshots, queue_metrics), die per Query Builder angesprochen werden.

Location: app/Models/

Alle Models nach Domäne

Core

ModelTabelleWichtige RelationsBeschreibung
SocialProfilesocial_profilesmetrics, images, latestImage, scores, youtubeVideos, watcherSources, contactLinks, exploreMetrics, relatedChannels, relatedProfiles, crossPlatformRelatedZentrales Profil-Model (YouTube/Instagram)
SocialProfileDailyMetricsocial_profile_daily_metricsprofileTägliche Follower/View/Video-Metriken
SocialProfileImagesocial_profile_imagesprofileProfilbilder mit Varianten (path_large 512px, path_medium 256px, path_thumbnail 128px, BlurHash)
SocialProfileLinksocial_profile_linkssocialProfile, approverKontakt-Links (URL, E-Mail, Social)
SocialProfileScoresocial_profile_scoresprofileScore-Verlauf (0–100, tier-normalisiert)
ProfileComparisonprofile_comparisonsuser, workspace, items, snapshotsGespeicherte 2–4-Profil-Vergleiche mit optionalen wöchentlichen Reminders
ProfileComparisonItemprofile_comparison_itemscomparison, socialProfileEinzelnes Profil in einem Vergleich (Position 1–4, feste Chart-Farbe)
ProfileComparisonSnapshotprofile_comparison_snapshotscomparison, overallLeaderHistorischer Snapshot für Vergleichs-Trends und wöchentliche Reminder

Watcher

ModelTabelleWichtige RelationsBeschreibung
Watcherwatchersworkspace, creator, sources, primarySourceSammlung beobachteter Profile
WatcherSourcewatcher_sourceswatcher, profileVerknüpfung Watcher ↔ SocialProfile
WatcherImportRunwatcher_import_runsfailures, itemsBulk-Import-Durchlauf
WatcherImportItemwatcher_import_itemsrunEinzelne URL im Import
WatcherImportFailurewatcher_import_failuresrunFehlgeschlagene Import-URL

YouTube

ModelTabelleWichtige RelationsBeschreibung
YouTubeVideoyoutube_videosprofile, dailyMetrics, scores, latestScoreVideo-Metadaten (PK: video_id string)
YouTubeVideoDailyMetricyoutube_video_daily_metricsvideoTägliche Video-Statistiken
YouTubeVideoScoreyoutube_video_scoresvideo, profileVideo-Score (View Perf. + Engagement + Growth + Freshness)
YouTubeVideoSyncyoutube_video_syncsprofile, requesterSync-Status für Video-Pipeline
YouTubeRelatedChannelyoutube_related_channelssourceProfile, relatedProfileVerwandte YouTube-Channels
YouTubeResearchQueryyoutube_research_queriesGespeicherte Recherche-Abfragen
YouTubeResearchKeywordCooldownyoutube_research_keyword_cooldowns14-Tage-Cooldown für verwendete Research-Keywords
YouTubeVideoStatsDailyAggregationyoutube_video_stats_daily_aggregationsTägliche Aggregation der Video-Stats-Coverage mit Gründe-Breakdown und Health-Score
YouTubePublishingWeeklyStatyoutube_publishing_weekly_statssocialProfileAggregierte Publishing-Statistiken pro Channel/Wochentag (VFR, Engagement, Stunden)
WebSubSubscriptionwebsub_subscriptionssocialProfileWebSub-Subscription für YouTube-Push-Notifications mit Lease-Renewal
PendingYouTubeChannelImportpending_you_tube_channel_importssourceProfileImport-Queue für entdeckte Channels

Instagram

ModelTabelleWichtige RelationsBeschreibung
CollectorJobcollector_jobsleasedByScraping-Auftrag (UUID-basiert)
CollectorClientcollector_clientsleasedJobsAuthentifizierter Scraping-Client (Sanctum)
InstagramProfileKeywordinstagram_profile_keywordssocialProfileExtrahierte Keywords aus Profil-Bio
InstagramRelatedProfileinstagram_related_profilessourceProfile, relatedProfileVerwandte Instagram-Profile

Dashboard & Explore

ModelTabelleWichtige RelationsBeschreibung
DashboardDailyRollupdashboard_daily_rollupsAggregierte Tagesmetriken pro Watcher/Profil
DailyScrapeProgressdaily_scrape_progressuserFortschritt des täglichen Scraping pro User
DailySyncRundaily_sync_runsStatus eines Sync-Durchlaufs (Datum-basiert)
ExploreProfileMetricexplore_profile_metricssocialProfileGrowth-, Trending- und Tier-Metriken
ExploreTrendingVideoexplore_trending_videossocialProfile, latestScoreTrending-Videos für Explore-Seite
ExploreCategoryexplore_categoriesKategorien für Explore-Filterung
CrossPlatformRelatedProfilecross_platform_related_profilessourceProfile, relatedProfilePlattformübergreifende Profil-Verknüpfung
ExploreDailySnapshotexplore_daily_snapshotsTäglicher Snapshot des Explore-Inventars (Profil-Counts, Plattform-Split, Tier-Verteilung)
PublicExplorerProfilepublic_explorer_profilessocialProfileÖffentliches Explorer-Profil mit AI-Beschreibungen (DE/EN), Kategorie, OG-Image-Pfad
OgImageLogog_image_logspublicExplorerProfileProtokoll der OG-Image-Generierung (Status, Dauer, Fehlerdetails)

User & Notification

ModelTabelleWichtige RelationsBeschreibung
Userusersworkspaces, notificationPreferences, quietHours, notificationsBenutzer (WorkOS SSO)
Workspaceworkspacesowner, watchersWorkspace mit Watchers
FavoriteSocialProfilefavorite_social_profilesuser, profileFavorisierte Profile
UserQuietHoursuser_quiet_hoursuserRuhezeiten-Konfiguration
NotificationPreferencenotification_preferencesuser, workspaceBenachrichtigungs-Einstellungen
NotificationStatnotification_statsAggregierte Benachrichtigungs-Statistiken
AnnouncementannouncementsreadsGeteilte Benachrichtigungen (1:n Reads)
AnnouncementReadannouncement_readsuser, announcementRead/Dismiss-Status
DatabaseNotificationnotificationsPer-User Notification (extends Laravel)
UserBlockuser_blocksuser, adminAudit-Log für User-Block/Unblock-Aktionen mit Grund
PersonalAccessTokenpersonal_access_tokensrevokedByUser, usageLogsCustom Sanctum-Token mit Soft-Revoke, IP-Whitelist und stündlichem Usage-Tracking
SearchHistorysearch_historyuserUser-Suchverlauf (max. 25 Einträge mit Auto-Pruning)

Admin & System

ModelTabelleWichtige RelationsBeschreibung
BlockedTagblocked_tagsblockerGesperrte Tags mit Cache
TagAliastag_aliasesTag-Umbenennungen mit Cache
TagConsolidationLogtag_consolidation_logsProtokoll Tag-Konsolidierung (MassPrunable)
GoogleApiQuotaLimitgoogle_api_quota_limitsYouTube API Quota-Limits
GoogleApiQuotaUsagegoogle_api_quota_usagesYouTube API Quota-Verbrauch
AiDetectionLogai_detection_logssocialProfileProtokoll AI-Erkennung (Sprache/Land)
AiManualOverrideLogai_manual_override_logssocialProfile, userAudit-Log für Admin-Overrides von AI-Feldern
ApiTokenUsageLogapi_token_usage_logspersonalAccessTokenStündliche API-Token-Request-Aggregation (90 Tage Retention)
ContactSubmissioncontact_submissionsuser (optional)Archiv der Kontaktformular-Einreichungen mit Anhängen und E-Mail-Status
CronHeartbeatEventcron_heartbeat_eventsCron-Heartbeat-Zustandsänderungen für SLA-Berechnung (30 Tage Retention)
DbMonitoringSnapshotdb_monitoring_snapshotsPostgreSQL-Systemmetriken alle 15 Min. (Connections, Locks, Cache-Hit-Ratio)
DbSlowQueryLogdb_slow_query_logStündliche Snapshots der Top-Slow-Queries aus pg_stat_statements
DbTableSizeSnapshotdb_table_size_snapshots15-Min-Snapshots der Top-10-Tabellen nach Größe für DB-Monitoring
DismissedErrorPathdismissed_error_pathsdismisserMarkiert Fehlerpfade als „kein Redirect nötig" + optional stummgeschaltet
ErrorPageDailyStaterror_page_daily_statsTägliches Rollup der Error-Page-Logs für Chart-Anzeige
ErrorPageLogerror_page_logs1 Zeile pro Pfad+Status+Stunde mit Hit-Count (PostgreSQL UPSERT)
HealthCheckLoghealth_check_logsTemporäres Health-Check-Kalibrierungs-Log (14 Tage Retention)
IndexNowSubmissionindex_now_submissionsTracking aller an IndexNow gesendeten URLs (30 Tage Retention)
MailLogmail_loguserE-Mail-Versandprotokoll
Pagepagescreator, updaterCMS-Seiten (Auditable) mit EN/DE-Feldern
PipelineRunpipeline_runsPersistente Pipeline-Step-Ausführungen (1 pro Step/Tag) für Trend-Analyse
R2MetricSnapshotr2_metric_snapshotsTäglicher R2-Bucket-Metriken-Snapshot (unbegrenzte Retention)
R2MetricHourlySnapshotr2_metric_hourly_snapshotsStündlicher R2-Metriken-Snapshot für Intraday-Trends (1 Jahr Retention)
SearchConsoleMetricsearch_console_metricsTägliche Google-Search-Console-Metriken pro URL/Query (Clicks, Impressions, CTR)
ServerMetricserver_metricsServer-Metriken alle 5 Min. (CPU, RAM, Swap, Disk, PG) — 90 Tage Retention
ServerMetricHourlyserver_metrics_hourlyStündliche Aggregation der Server-Metriken (365 Tage Retention)
SitemapDailySnapshotsitemap_daily_snapshotsTäglicher Snapshot der Sitemap-Generierung (URL-Counts, Dateigröße, Validierung)
UrlRedirecturl_redirectscreatorURL-Redirect mit Regex-Support und Hit-Counter (HandleRedirects Middleware)
WebVitalMetricweb_vitals_metricsAggregierte Web-Vitals-Metriken pro URL und Metrik-Name (LCP, FID, CLS)

Tabellen ohne Model

TabelleVerwendet inBeschreibung
dashboard_leaderboard_snapshotsBuildDashboardLeaderboardSnapshots, LeaderboardPriorityServiceTägliche Top-100-Snapshots
dashboard_global_snapshotsBuildGlobalLeaderboardSnapshots, TopsFlops/IndexGlobale Leaderboard-Daten
queue_metricsSnapshotQueueMetrics, QueueMetricsChartQueue-Performance-Metriken

SocialProfile Status-Hierarchie

Das zentrale SocialProfile-Model besitzt mehrere unabhängige Status-Flags, die verschiedene Aspekte des Profil-Lifecycles steuern:

FlagTypGesetzt durchBedeutungAusschluss von
blocked_atdatetimeAdmin manuellAdmin-SperreExplore, Related, Scoring, Scraping
sanitized_atdatetimeprofiles:sanitize CommandAuto-Deaktivierung (Low-Value-Metriken)Explore, Related, Scoring, Scraping
deactivated_atdatetimeCollector-Jobs (Fail-Streak)Scraping-Fehler, Retry-LifecycleScraping
archived_atdatetimeprofiles:retry-inactivePermanent archiviert (>6 Monate inaktiv)Alles (kein Retry)
tracking_enabledbooleanDiverse SystemeMaster-Schalter für TrackingScraping, Scoring

Scopes

// Nur nicht-gesperrte Profile
SocialProfile::notBlocked() // whereNull('blocked_at')

// Nur nicht-sanitized Profile
SocialProfile::notSanitized() // whereNull('sanitized_at')

// Ausschluss aller inaktiven Profile (für Explore, Related, Leaderboards)
SocialProfile::notExcluded() // whereNull('blocked_at') + whereNull('sanitized_at') + whereNull('archived_at')

Admin Override (Sanitizer)

Wenn ein Admin ein sanitized Profil über enableTracking() reaktiviert, wird sanitize_checked_at beibehalten. Der Sanitizer überspringt Profile mit sanitize_checked_at IS NOT NULL AND sanitized_at IS NULL -- permanenter Schutz vor erneuter Auto-Deaktivierung.

Ausschluss-Filter (Pflicht)

Bei allen öffentlich sichtbaren Queries (Explore, Related Channels/Profiles, Leaderboards) muss notExcluded() oder ein manueller whereNull-Check verwendet werden:

// Explore / Related / Leaderboards
SocialProfile::notExcluded()->where(...)

// Related-Profile mit Eager Loading
->whereHas('relatedProfile', fn ($q) => $q
->whereNull('blocked_at')
->whereNull('sanitized_at')
->whereNull('archived_at')
)

Location: app/Models/SocialProfile.php