Zum Hauptinhalt springen

Dashboard & Explore Models

Diese Domäne umfasst die aggregierten Metriken für das Dashboard (Rollups, Sync-Tracking) sowie die Explore-Features (Trending, Growth, Kategorien, Cross-Platform).

DashboardDailyRollup

Aggregierte Tagesmetriken pro Profil, gruppiert nach Owner, Workspace und Watcher. Basis für die Dashboard-Charts und Leaderboards. Wird per dashboard:rollup-daily-metrics (täglich 00:45 UTC) befüllt.

Tabelle: dashboard_daily_rollups

FeldTypNullableBeschreibung
idbigintPKPrimary Key
datedateneinDatum des Rollups
owner_idbigint (FK)neinUser-ID des Workspace-Owners
workspace_idbigint (FK)neinWorkspace-ID
watcher_idbigint (FK)neinWatcher-ID
social_profile_idbigint (FK)neinProfil-ID
followers_countbigintjaFollower/Subscriber-Anzahl
view_countbigintjaAufrufe (YouTube)
video_countintegerjaAnzahl Videos (YouTube)
comment_countbigintjaKommentare (YouTube)
following_countintegerjaFollowing (Instagram)
post_countintegerjaPosts (Instagram)
created_atdatetimeneinErstellt am
updated_atdatetimeneinAktualisiert am

Casts: date → date

Hinweis: Der Rollup enthält keine Relations, da die Daten per Query Builder aggregiert werden. Die Tabelle wird per Command dashboard:rollup-daily-metrics aus social_profile_daily_metrics befüllt.

Location: app/Models/DashboardDailyRollup.php


DailyScrapeProgress

Fortschritt des täglichen Scrapings pro User. Wird genutzt, um dem User Feedback zum Sync-Fortschritt seiner Profile zu geben. Löst DailyScrapeCompleted-Event bei 100% aus.

Tabelle: daily_scrape_progress

FeldTypNullableBeschreibung
idbigintPKPrimary Key
user_idbigint (FK)neinZugehöriger User
datedateneinScrape-Datum
expected_countintegerneinErwartete Profile
completed_countintegerneinErfolgreich gescrapte
failed_countintegerneinFehlgeschlagene
notification_sentbooleanneinBenachrichtigung bereits versandt
created_atdatetimeneinErstellt am
updated_atdatetimeneinAktualisiert am

Relations:

MethodeTypRelated ModelFKBeschreibung
user()belongsToUseruser_idZugehöriger User

Casts: date → date, notification_sent → boolean

Methoden: isComplete() -- prüft ob completed_count + failed_count >= expected_count

Location: app/Models/DailyScrapeProgress.php


DailySyncRun

Status eines täglichen Sync-Durchlaufs. Wird vom ExploreMetricsCalculator genutzt, um "complete" Sync-Tage als Datengrundlage zu identifizieren.

Tabelle: daily_sync_runs

FeldTypNullableBeschreibung
idbigintPKPrimary Key
datedateneinSync-Datum (unique)
expected_profilesintegerneinErwartete Profile
processed_profilesintegerneinVerarbeitete Profile
failed_profilesintegerneinFehlgeschlagene
statusstringneinrunning, completed, failed
finished_atdatetimejaAbschluss-Zeitpunkt
created_atdatetimeneinErstellt am
updated_atdatetimeneinAktualisiert am

Casts: date → date, finished_at → datetime

Status-Werte:

StatusBeschreibung
runningSync läuft noch
completedErfolgreich abgeschlossen
failedFehlgeschlagen

Methoden: latestCompleteDate() (static) -- gibt das neueste Datum zurück, an dem der Sync vollständig war.

Location: app/Models/DailySyncRun.php


ExploreProfileMetric

Berechnete Explore-Metriken pro Profil. Enthält Growth-Daten (1d/7d/30d), Trending-Score, Tier-Klassifizierung und Flags wie is_rising_star. Wird per explore:calculate (täglich 03:00 UTC) aktualisiert.

Tabelle: explore_profile_metrics

FeldTypNullableBeschreibung
idbigintPKPrimary Key
social_profile_idbigint (FK)neinZugehöriges Profil (unique)
followers_countbigintjaAktuelle Follower-Anzahl
followers_growth_1dbigintjaAbsolutes Wachstum 1 Tag
followers_growth_7dbigintjaAbsolutes Wachstum 7 Tage
followers_growth_30dbigintjaAbsolutes Wachstum 30 Tage
followers_growth_pct_1dfloatjaProzentuales Wachstum 1 Tag
followers_growth_pct_7dfloatjaProzentuales Wachstum 7 Tage
followers_growth_pct_30dfloatjaProzentuales Wachstum 30 Tage
trending_scorefloatjaAktueller Trending-Score
previous_trending_scorefloatjaVorheriger Trending-Score
growth_scorefloatjaWachstums-Score
consistency_scorefloatjaKonsistenz-Score
follower_tierstringjamicro, small, medium, large, mega
primary_categorystringjaHauptkategorie
detected_tagsjsonjaErkannte Tags (Array)
is_rising_starbooleanjaÜberdurchschnittliches Wachstum im Tier
is_newbooleanjaNeu in Explore
is_trendingbooleanjaAktuell trendend
trending_calculated_atdatetimejaLetzte Trending-Berechnung
daily_calculated_atdatetimejaLetzte tägliche Berechnung
weekly_calculated_atdatetimejaLetzte wöchentliche Berechnung
created_atdatetimeneinErstellt am
updated_atdatetimeneinAktualisiert am

Relations:

MethodeTypRelated ModelFKBeschreibung
socialProfile()belongsToSocialProfilesocial_profile_idZugehöriges Profil

Scopes:

ScopeBeschreibung
minFollowers($count)Minimum Follower-Anzahl
tier($tier)Nach Follower-Tier filtern
risingStars()Nur Rising Stars
newProfiles()Nur neue Profile

Konstanten:

MIN_FOLLOWERS_FOR_EXPLORE = 100

TIER_BOUNDARIES = [
'micro' => [0, 10_000],
'small' => [10_000, 100_000],
'medium' => [100_000, 500_000],
'large' => [500_000, 1_000_000],
'mega' => [1_000_000, PHP_INT_MAX],
]

Accessors: tier_label, formatted_growth_7d

Methoden: calculateTier() (static)

Location: app/Models/ExploreProfileMetric.php


ExploreTrendingVideo

Trending-Videos für die Explore-Seite. Enthält Velocity- und Trending-Scores basierend auf View-Growth über verschiedene Zeiträume.

Tabelle: explore_trending_videos

FeldTypNullableBeschreibung
idbigintPKPrimary Key
social_profile_idbigint (FK)neinZugehöriger Channel
video_idstringneinYouTube Video-ID
titlestringjaVideo-Titel
thumbnail_urlstringjaThumbnail-URL
channel_titlestringjaChannel-Name
duration_secondsintegerjaDauer in Sekunden
view_countbigintjaAktuelle Views
like_countbigintjaAktuelle Likes
view_growth_1hbigintjaView-Wachstum letzte Stunde
view_growth_24hbigintjaView-Wachstum 24 Stunden
view_growth_7dbigintjaView-Wachstum 7 Tage
velocity_scorefloatjaVelocity-Score (Views/Zeiteinheit)
trending_scorefloatjaTrending-Score
published_atdatetimejaVeröffentlichungsdatum
calculated_atdatetimejaLetzte Berechnung
created_atdatetimeneinErstellt am
updated_atdatetimeneinAktualisiert am

Relations:

MethodeTypRelated ModelFKBeschreibung
socialProfile()belongsToSocialProfilesocial_profile_idZugehoeriger Channel
video()belongsToYouTubeVideovideo_idYouTube-Video-Record (fuer R2-Thumbnails, Tags)
latestScore()hasOneYouTubeVideoScoreyoutube_video_idNeuester Video-Score

Scopes:

ScopeBeschreibung
publishedWithin($days)Videos veröffentlicht in X Tagen
trending()Nach Trending-Score sortiert

Accessors: engagement_rate, url, formatted_duration, formatted_views, formatted_growth_24h

Location: app/Models/ExploreTrendingVideo.php


ExploreCategory

Kategorien für die Explore-Seite. Enthält Keywords und YouTube-Kategorie-IDs für automatisches Matching.

Tabelle: explore_categories

FeldTypNullableBeschreibung
idbigintPKPrimary Key
slugstringneinURL-Slug (unique)
namestringneinEnglischer Name
name_destringjaDeutscher Name
iconstringjaEmoji-Icon fuer UI-Anzeige
keywordsjsonjaZugehörige Keywords (Array)
youtube_category_idsjsonjaYouTube-Kategorie-IDs (Array)
profile_countintegerneinAnzahl zugeordneter Profile
sort_orderintegerneinSortierreihenfolge
is_activebooleanneinAktiv/Sichtbar
created_atdatetimeneinErstellt am
updated_atdatetimeneinAktualisiert am

Scopes:

ScopeBeschreibung
active()Nur aktive Kategorien
ordered()Nach sort_order sortiert

Casts: keywords → array, youtube_category_ids → array, profile_count → integer, sort_order → integer, is_active → boolean

Accessors: localized_name -- gibt name_de zurück falls vorhanden, sonst name.

Location: app/Models/ExploreCategory.php


ExploreDailySnapshot

Taegliche Explore-Inventar-Snapshots mit Statistiken zur Bestandsentwicklung. Wird durch pipeline:run (taeglich 01:00 UTC) befuellt.

Tabelle: explore_daily_snapshots

FeldTypNullableBeschreibung
idbigintPKPrimary Key
datedateneinSnapshot-Datum (unique)
total_profilesintegerjaGesamtzahl Profile in Explore
youtube_countintegerjaYouTube Profile
instagram_countintegerjaInstagram Profile
tier_megaintegerjaMega Tier (1M+)
tier_largeintegerjaLarge Tier (500k-1M)
tier_mediumintegerjaMedium Tier (100k-500k)
tier_smallintegerjaSmall Tier (10k-100k)
tier_microintegerjaMicro Tier (0-10k)
trending_countintegerjaTrending Profile Count
rising_stars_countintegerjaRising Stars Count
categorized_countintegerjaKategorisierte Profile
new_profiles_countintegerjaNeue Profile
avg_trending_scorefloatjaDurchschnittlicher Trending-Score
created_atdatetimeneinErstellt am

Hinweis: $timestamps = false — nur created_at wird befuellt, kein updated_at.

Casts: date → date:Y-m-d, avg_trending_score → float, created_at → datetime

Location: app/Models/ExploreDailySnapshot.php


CrossPlatformRelatedProfile

Plattformuebergreifende Profil-Verknuepfungen (z.B. ein YouTuber und sein Instagram-Account). Wird durch pipeline:run (taeglich 01:00 UTC) befuellt.

Tabelle: cross_platform_related_profiles

FeldTypNullableBeschreibung
idbigintPKPrimary Key
source_profile_idbigint (FK)neinQuell-Profil
related_profile_idbigint (FK)neinVerknuepftes Profil (andere Plattform)
relevance_scoreintegerjaRelevanz (0-100)
match_reasonstringjaGrund der Verknuepfung
cross_profile_verified_atdatetimejaAdmin-Verifizierungszeitpunkt
cross_profile_verified_bybigint (FK)jaAdmin-User-ID der Verifizierung
created_atdatetimeneinErstellt am
updated_atdatetimeneinAktualisiert am

Relations:

MethodeTypRelated ModelFKBeschreibung
sourceProfile()belongsToSocialProfilesource_profile_idQuell-Profil
relatedProfile()belongsToSocialProfilerelated_profile_idVerknuepftes Profil
verifiedByUser()belongsToUsercross_profile_verified_byVerifizierender Admin

Scopes: verified() — nur admin-verifizierte Verknuepfungen.

Methoden: isVerified() — prueft ob Verknuepfung von Admin verifiziert wurde.

Casts: relevance_score → integer, cross_profile_verified_at → datetime

Location: app/Models/CrossPlatformRelatedProfile.php