Files
laraundfelix/app/Domain/Media/DeliveryLog.php
T
LarsandClaude Sonnet 5.5 d1f97a351a
CI Feature / test (push) Successful in 3m32s
Führe Übungen als Fassungen mit Varianten, Verwendung und Mitgliederausgabe ein
Neuer kind 'exercise', Varianten je Fassung, Verwendung (erforderlich/ergänzend) und Variantenauswahl am einbindenden
Mitglied; der Stand schreibt nur gewählte Varianten fest. Änderungsnachweis über structure_hash. Formatierte Anleitung
im Mitgliederbereich und PDF (Fußzeile, Metadaten, Ausgabenachweis, keine gespeicherten Kopien); Sperre trifft nur das
Medium.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 16:52:01 +01:00

45 lines
1.3 KiB
PHP

<?php
namespace App\Domain\Media;
use App\Domain\Catalog\ArticleRelease;
use App\Domain\Catalog\ContentElementVersion;
use App\Domain\Catalog\LicenseArticle;
use App\Domain\Entitlement\Grant;
use App\Domain\Entitlement\MediaDelivery;
class DeliveryLog
{
public function write(
Grant $grant,
LicenseArticle $article,
ArticleRelease $release,
ContentElementVersion $version,
string $action,
string $format,
?string $checksum,
string $marking,
?string $copyId = null,
?int $compositionVersionId = null,
): MediaDelivery {
return MediaDelivery::query()->create([
'grant_id' => $grant->id,
'license_article_id' => $article->id,
'article_release_id' => $release->id,
'content_element_version_id' => $version->id,
'action' => $action,
'format' => $format,
'copy_id' => $copyId ?? self::newCopyId(),
'composition_version_id' => $compositionVersionId,
'checksum' => $checksum,
'marking' => $marking,
'delivered_at' => now(),
]);
}
public static function newCopyId(): string
{
return 'LK-'.strtoupper(bin2hex(random_bytes(6)));
}
}