Eine Komposition mit einem kind-Wert, den erst ein neuerer Stand schreibt, gilt als nicht vorhanden (globaler Bereichsfilter statt Absturz im Enum-Cast). Aufbauten mit solchen Bestandteilen werden hier weder veröffentlicht noch als Angebot aktiviert, der Editor bleibt schreibgeschützt, die Mitgliederansicht zeigt den Bestandteil nicht. Grundlage für die Übungsverwaltung, damit ein Rückfall nichts verliert oder offenlegt. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Catalog;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Composition extends Model
|
|
{
|
|
protected $fillable = [
|
|
'designation',
|
|
'display_title',
|
|
'teaser',
|
|
'summary',
|
|
'description',
|
|
'search_terms',
|
|
'thumbnail_path',
|
|
'thumbnail_alt',
|
|
'thumbnail_source',
|
|
'thumbnail_error',
|
|
'public_slug',
|
|
'kind',
|
|
'editorial_content_kind_id',
|
|
'archived_at',
|
|
'working_draft',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'kind' => CompositionKind::class,
|
|
'archived_at' => 'datetime',
|
|
'working_draft' => 'array',
|
|
];
|
|
}
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::addGlobalScope(new SupportedKindScope);
|
|
}
|
|
|
|
public function editorialContentKind(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EditorialContentKind::class);
|
|
}
|
|
|
|
public function versions(): HasMany
|
|
{
|
|
return $this->hasMany(CompositionVersion::class);
|
|
}
|
|
|
|
/**
|
|
* Direkt zugeordnete fachliche Säulen (zentrale Säulenverwaltung). Die Säulen der enthaltenen Medien sind davon
|
|
* getrennt und werden zur Laufzeit abgeleitet (CatalogReading::memberPillars).
|
|
*/
|
|
public function pillars(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Pillar::class)->orderBy('pillars.sort_order')->orderBy('pillars.name');
|
|
}
|
|
}
|