presseportale/app/Models/LegalRequest.php
Kevin Adametz 95007da826 WS-3: Recht & Compliance – Rechts-Kern (DSGVO/Persönlichkeitsrecht/Melden + Queue)
Launch-pflichtiger Compliance-Slice: öffentliche Anfrage zu einer PM speist eine
manuelle Admin-Queue (keine KI).

- Migration legal_requests + Model + Enums (Type: dsgvo/personal_rights/report,
  Status: open/in_progress/resolved/rejected) + Factory.
- Öffentliches Formular /release/{slug}/rechtliches (LegalRequestController +
  web/legal-request.blade.php): typ-abhängiger Hinweistext (Alpine), E-Mail bei
  DSGVO/Persönlichkeitsrecht erforderlich, zwei versteckte Honeypot-Felder,
  Rate-Limit + Bremse "1 offene Anfrage pro PM/Typ". Regeltexte als Entwurf mit
  TODO für rechtliche Finalisierung markiert.
- Routen bewusst in eigener routes/legal.php (entkoppelt vom laufenden Web-Umbau),
  host-agnostisch via domains.php eingebunden.
- Admin-Bereich "Recht & Compliance": Sidebar-Nav mit Offen-Zähler, Volt-Queue
  index/show (in Bearbeitung/erledigt/abgelehnt/wieder öffnen + interne Notiz).
- Tests: je Typ, Honeypots (Dataset), Bremse, Admin-Queue + Status-Übergänge.
- Doku: Detailplan WS-3-Status + Deployment-Migrationsreihenfolge ergänzt.

Hinweis: Der "Melden"-/E&F-Button auf der PM-Detailseite (release-detail.blade.php)
wird mit dem separaten Web-Frontend-Commit verdrahtet; Ziel ist legal-request.create.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 14:20:05 +00:00

68 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Models;
use App\Enums\LegalRequestStatus;
use App\Enums\LegalRequestType;
use Database\Factories\LegalRequestFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Rechts-/Compliance-Anfrage (WS-3) DSGVO, Persönlichkeitsrecht oder Meldung.
* Bewusst OHNE PortalScope: der Admin-Bereich „Recht & Compliance" sieht alle
* Portale; das Portal wird zur Anzeige/Filterung als eigene Spalte gehalten.
*/
class LegalRequest extends Model
{
/** @use HasFactory<LegalRequestFactory> */
use HasFactory;
protected $fillable = [
'press_release_id',
'portal',
'type',
'status',
'requester_email',
'message',
'payload',
'requester_ip',
'resolved_by_user_id',
'admin_note',
'resolved_at',
];
protected function casts(): array
{
return [
'type' => LegalRequestType::class,
'status' => LegalRequestStatus::class,
'payload' => 'array',
'resolved_at' => 'datetime',
];
}
public function pressRelease(): BelongsTo
{
return $this->belongsTo(PressRelease::class);
}
public function resolver(): BelongsTo
{
return $this->belongsTo(User::class, 'resolved_by_user_id');
}
/**
* @param Builder<LegalRequest> $query
* @return Builder<LegalRequest>
*/
public function scopeOpen(Builder $query): Builder
{
return $query->whereIn('status', [
LegalRequestStatus::Open->value,
LegalRequestStatus::InProgress->value,
]);
}
}