Files
laraundfelix/app/Http/CourseOutline.php
T
LarsandCursor 1a2b1298b5
Deploy Test / test (push) Failing after 8s
Deploy Test / deploy (push) Skipped
Paket 2: konfigurierbare Inhaltsart an Identitaet
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-16 06:56:47 +01:00

54 lines
1.4 KiB
PHP

<?php
namespace App\Http;
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\LicenseArticle;
class CourseOutline
{
public function title(LicenseArticle $article): string
{
$release = $article->currentRelease;
if ($release === null) {
return $article->code;
}
$release->loadMissing([
'rootCompositionVersion.composition',
'rootElementVersion.element',
]);
return $release->rootCompositionVersion?->composition?->designation
?? $release->rootElementVersion?->element?->working_title
?? $release->classification_note
?? $article->code;
}
public function kindLabel(LicenseArticle $article): ?string
{
$release = $article->currentRelease;
if ($release === null) {
return null;
}
$release->loadMissing([
'rootCompositionVersion.composition.editorialContentKind',
'rootElementVersion.element.editorialContentKind',
]);
$editorial = $release->rootCompositionVersion?->composition?->editorialContentKind?->label
?? $release->rootElementVersion?->element?->editorialContentKind?->label;
if ($editorial !== null) {
return $editorial;
}
$kind = $release->rootCompositionVersion?->composition?->kind;
return $kind instanceof CompositionKind ? $kind->label() : null;
}
}