Ergänze das U1-Fachmodell für Inhalt, Paket und Angebot.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2035c46edd
commit
2ded4b7fad
35 files changed
+2115
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Catalog;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class RightsProfileVersion extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'rights_profile_id',
|
||||
'number',
|
||||
'purpose',
|
||||
'capabilities',
|
||||
'options',
|
||||
'locked_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'capabilities' => 'array',
|
||||
'options' => 'array',
|
||||
'locked_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::updating(function (RightsProfileVersion $version): void {
|
||||
if ($version->getOriginal('locked_at') !== null) {
|
||||
throw new DomainRuleException('Eine verwendete Rechteprofil-Fassung ist unveränderlich.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function profile(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(RightsProfile::class, 'rights_profile_id');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user