Quellübung mit stabiler Kennung und Inhaltswert, genau ein Stand je Prüfsumme, bewusste Übernahme als neue lokale Fassung, lokale Ergänzungen bleiben erhalten, Ausblenden an der Quelle setzt nur die Verfügbarkeit. Seite Übernahme (Shinkan), Feldzuordnung, ADR-49 (inklusive Abweichung bei der Mediensperre), Abnahmestand und Rückfallverfahren. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Catalog;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* Eine Übung der Quelle, gebunden an ihre stabile Kennung. `availability` hält nur fest, ob die Quelle sie noch
|
|
* bereitstellt. Das ist kein Rechtsvorgang: Eine rechtliche Sperre ist der lokale `block`.
|
|
*/
|
|
class ExerciseSource extends Model
|
|
{
|
|
public const PROVIDED = 'bereitgestellt';
|
|
|
|
public const WITHDRAWN = 'nicht_mehr_bereitgestellt';
|
|
|
|
protected $fillable = ['source_system', 'source_id', 'composition_id', 'title', 'availability', 'last_hash', 'last_seen_at'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['last_seen_at' => 'datetime'];
|
|
}
|
|
|
|
public function composition(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Composition::class);
|
|
}
|
|
|
|
public function snapshots(): HasMany
|
|
{
|
|
return $this->hasMany(ExerciseSourceSnapshot::class)->orderBy('id');
|
|
}
|
|
|
|
public function latestSnapshot(): ?ExerciseSourceSnapshot
|
|
{
|
|
return $this->snapshots()->reorder()->orderByDesc('id')->first();
|
|
}
|
|
}
|