Admin & System Models
System-Models für Tag-Management, Google API Quota-Tracking, AI-Detection-Logging, E-Mail-Protokollierung und das CMS. Zusätzlich existieren die Tabellen dashboard_leaderboard_snapshots, dashboard_global_snapshots und queue_metrics ohne dediziertes Model.
BlockedTag
Gesperrte Tags, die aus Explore-Ergebnissen und Profil-Tags herausgefiltert werden. Verwendet einen 1h-Cache für schnellen Zugriff.
Tabelle: blocked_tags
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
tag | string | nein | Gesperrter Tag (unique) |
blocked_by | bigint (FK) | ja | Admin-User, der den Tag gesperrt hat |
blocked_at | datetime | ja | Zeitpunkt der Sperre |
reason | string | ja | Sperrgrund |
created_at | datetime | nein | Erstellt am |
updated_at | datetime | nein | Aktualisiert am |
Relations:
| Methode | Typ | Related Model | FK | Beschreibung |
|---|---|---|---|---|
blocker() | belongsTo | User | blocked_by | Sperrender Admin |
Casts: blocked_at → datetime
Methoden:
| Methode | Return | Beschreibung |
|---|---|---|
cachedList() (static) | Collection | Alle gesperrten Tags (1h Cache) |
flushCache() (static) | void | Cache invalidieren |
Location: app/Models/BlockedTag.php
TagAlias
Tag-Umbenennungen (Source-Tag wird auf Target-Tag gemappt). Verwendet einen 1h-Cache mit statischer resolve()-Methode.
Tabelle: tag_aliases
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
source_tag | string | nein | Quell-Tag (unique) |
target_tag | string | nein | Ziel-Tag |
created_at | datetime | nein | Erstellt am |
updated_at | datetime | nein | Aktualisiert am |
Methoden:
| Methode | Return | Beschreibung |
|---|---|---|
cachedMap() (static) | Collection | Alle Aliases als Key-Value-Map (1h Cache) |
resolve($tag) (static) | string | Löst einen Tag auf (folgt Alias-Chain) |
flushCache() (static) | void | Cache invalidieren |
Location: app/Models/TagAlias.php
TagConsolidationLog
Protokoll der Tag-Konsolidierung. Aufzeichnung welche Tags zusammengefasst wurden, mit Confidence-Score und betroffenen Profilen. Verwendet MassPrunable -- Einträge älter als 1 Jahr werden automatisch gelöscht.
Tabelle: tag_consolidation_logs
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
batch_id | string | nein | Batch-Identifier (gruppiert zusammengehörige Aktionen) |
source_tag | string | nein | Konsolidierter Quell-Tag |
target_tag | string | nein | Ziel-Tag |
action | string | nein | Aktion (merge, rename, delete) |
confidence | float | ja | Confidence-Score der Konsolidierung |
reason | string | ja | Begründung |
affected_profiles | integer | ja | Anzahl betroffener Profile |
status | string | nein | completed, failed |
error_message | text | ja | Fehlermeldung bei Fehler |
created_at | datetime | nein | Erstellt am |
updated_at | datetime | nein | Aktualisiert am |
Traits: MassPrunable -- löscht automatisch Einträge älter als 1 Jahr.
Location: app/Models/TagConsolidationLog.php
GoogleApiQuotaLimit
Gespeicherte Quota-Limits des Google Cloud Projekts. Wird per google:sync-api-usage (stündlich) aktualisiert.
Tabelle: google_api_quota_limits
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
project_id | string | nein | Google Cloud Projekt-ID |
service | string | nein | API-Service (z.B. youtube.googleapis.com) |
quota_metric | string | nein | Quota-Metrik-Name |
display_name | string | ja | Anzeigename |
unit | string | ja | Einheit |
limit_value | integer | nein | Limit-Wert |
effective_limit_value | integer | ja | Effektiver Limit-Wert |
raw | json | ja | Rohdaten der API-Response |
created_at | datetime | nein | Erstellt am |
updated_at | datetime | nein | Aktualisiert am |
Casts: limit_value → integer, effective_limit_value → integer, raw → array
Location: app/Models/GoogleApiQuotaLimit.php
GoogleApiQuotaUsage
Täglicher Quota-Verbrauch pro Service und Metrik. Kann nach Credential aufgeschlüsselt werden (Multi-Key-Rotation).
Tabelle: google_api_quota_usages
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
project_id | string | nein | Google Cloud Projekt-ID |
service | string | nein | API-Service |
quota_metric | string | nein | Quota-Metrik-Name |
date | date | nein | Verbrauchsdatum |
used_value | integer | nein | Verbrauchter Wert |
by_credential | json | ja | Aufschlüsselung nach Credential |
collected_at | datetime | ja | Erfassungszeitpunkt |
created_at | datetime | nein | Erstellt am |
updated_at | datetime | nein | Aktualisiert am |
Casts: date → date, used_value → integer, by_credential → array, collected_at → datetime
Location: app/Models/GoogleApiQuotaUsage.php
AiDetectionLog
Protokoll aller AI-Erkennungsläufe (Sprache, Land, Beschreibung) per Gemini API. Erfasst Tokens, Dauer und Ergebnis.
Tabelle: ai_detection_logs
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
social_profile_id | bigint (FK) | ja | Zugehöriges Profil (nullable seit Migration 96) |
type | string | nein | Detection-Typ (language, country, description) |
model | string | nein | Verwendetes AI-Model |
input_data | json | nein | Eingabedaten |
output_data | json | ja | Ausgabedaten (bei Erfolg) |
raw_response | json | ja | Rohe API-Response |
status | string | nein | success, failed, error |
error_message | text | ja | Fehlermeldung |
tokens_used | integer | ja | Verbrauchte Tokens |
duration_ms | integer | ja | Dauer in Millisekunden |
created_at | datetime | nein | Erstellt am |
updated_at | datetime | nein | Aktualisiert am |
Relations:
| Methode | Typ | Related Model | FK | Beschreibung |
|---|---|---|---|---|
socialProfile() | belongsTo | SocialProfile | social_profile_id | Zugehöriges Profil |
Casts: input_data → array, output_data → array, raw_response → array, tokens_used → integer, duration_ms → integer
Accessors: confidence, detected_language, detected_country, duration_for_humans
Methoden: isSuccess()
Location: app/Models/AiDetectionLog.php
MailLog
Protokolliert versandte E-Mails. Keine automatischen Timestamps -- nur created_at wird manuell gesetzt.
Tabelle: mail_log
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
user_id | bigint (FK) | ja | Empfänger-User |
mail_type | string | nein | E-Mail-Typ |
recipient | string | nein | Empfänger-Adresse |
subject | string | ja | Betreff |
status | string | nein | sent, failed |
error_message | text | ja | Fehlermeldung bei Fehler |
created_at | datetime | nein | Versandzeitpunkt |
Relations:
| Methode | Typ | Related Model | FK | Beschreibung |
|---|---|---|---|---|
user() | belongsTo | User | user_id | Empfänger-User |
Timestamps: false (nur created_at manuell)
Casts: created_at → datetime
Location: app/Models/MailLog.php
Page
CMS-Seiten mit Audit-Trail. URL-Format: /{slug}_p{id} (z.B. /impressum_p1). Unterstützt Navigation in Header, Footer und Sidebar.
Tabelle: pages
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
slug | string | nein | URL-Slug |
title | string | nein | Seitentitel |
content | text | ja | Seiteninhalt (Markdown/HTML) |
meta_description | text | ja | Meta-Description |
is_meta_auto | boolean | nein | Meta-Description automatisch generiert |
is_draft | boolean | nein | Entwurf |
is_review_needed | boolean | nein | Review benötigt |
is_published | boolean | nein | Veröffentlicht |
nav_priority | integer | nein | Navigations-Priorität |
show_in_header | boolean | nein | In Header-Navigation anzeigen |
show_in_footer | boolean | nein | In Footer-Navigation anzeigen |
show_in_sidebar | boolean | nein | In Sidebar-Navigation anzeigen |
created_by | bigint (FK) | ja | Ersteller |
updated_by | bigint (FK) | ja | Letzter Bearbeiter |
created_at | datetime | nein | Erstellt am |
updated_at | datetime | nein | Aktualisiert am |
Relations:
| Methode | Typ | Related Model | FK | Beschreibung |
|---|---|---|---|---|
creator() | belongsTo | User | created_by | Ersteller |
updater() | belongsTo | User | updated_by | Letzter Bearbeiter |
Traits: Auditable (OwenIt\Auditing) -- protokolliert alle Änderungen.
Scopes:
| Scope | Beschreibung |
|---|---|
published() | Nur veröffentlichte Seiten |
forHeader() | Header-Navigation |
forFooter() | Footer-Navigation |
forSidebar() | Sidebar-Navigation |
drafts() | Nur Entwürfe |
needsReview() | Review benötigt |
Accessors: url, canonical_path, status, status_color, status_label
Methoden: generateSlug(), generateMetaDescription(), parseUrlPath() (static), findByIdWithRedirectCheck() (static)
URL-Format: /{slug}_p{id} -- z.B. /impressum_p1, /datenschutz_p2
Location: app/Models/Page.php
UserBlock
Audit-Log fuer User-Blocking-Aktionen (Block/Unblock). Jede Aktion wird mit Admin-ID, Grund und Zeitstempel protokolliert.
Tabelle: user_blocks
| Feld | Typ | Nullable | Beschreibung |
|---|---|---|---|
id | bigint | PK | Primary Key |
user_id | bigint (FK) | nein | Betroffener User |
admin_id | bigint (FK) | nein | Handelnder Admin |
action | string | nein | blocked oder unblocked |
reason | text | ja | Begruendung |
created_at | datetime | nein | Erstellt am |
updated_at | datetime | nein | Aktualisiert am |
Relations:
| Methode | Typ | Related Model | FK | Beschreibung |
|---|---|---|---|---|
user() | belongsTo | User | user_id | Betroffener User |
admin() | belongsTo | User | admin_id | Handelnder Admin |
Indexes: user_id, created_at
Location: app/Models/UserBlock.php
Tabellen ohne Model
dashboard_leaderboard_snapshots
Tägliche Top-100-Snapshots pro Watcher, Workspace und Owner. Wird per BuildDashboardLeaderboardSnapshots-Command befüllt und vom LeaderboardPriorityService gelesen. Keine Eloquent-Abstraktion -- ausschließlich per Query Builder.
Location: app/Console/Commands/BuildDashboardLeaderboardSnapshots.php, app/Services/Dashboard/LeaderboardPriorityService.php
dashboard_global_snapshots
Globale Leaderboard-Daten mit Tier-Aufschlüsselung. Wird per BuildGlobalLeaderboardSnapshots-Command befüllt. Basis für die TopsFlops-Seite.
Location: app/Console/Commands/BuildGlobalLeaderboardSnapshots.php, app/Livewire/TopsFlops/Index.php
queue_metrics
Performance-Snapshots der Queue-Worker. Wird per SnapshotQueueMetrics-Command erfasst und im Admin Queue-Metrics-Chart angezeigt.
Location: app/Console/Commands/SnapshotQueueMetrics.php, app/Livewire/Admin/LogQueue/QueueMetricsChart.php