42 lines
978 B
PHP
42 lines
978 B
PHP
<?php
|
|
|
|
namespace App\Domain\Entitlement;
|
|
|
|
use App\Domain\Identity\Party;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* Individuelle Berechtigungsquelle eines Inhabers. Die Entscheidung, wann ein Erwerb entsteht, folgt später.
|
|
* Der Bezug ist je Typ eine Bestellposition, ein Angebot, ein Verwaltungsvorgang oder ein Abonnement.
|
|
*/
|
|
class Acquisition extends Model
|
|
{
|
|
protected $fillable = [
|
|
'party_id',
|
|
'type',
|
|
'reference_type',
|
|
'reference_id',
|
|
'conditions',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'type' => AcquisitionType::class,
|
|
'conditions' => 'array',
|
|
];
|
|
}
|
|
|
|
public function party(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Party::class);
|
|
}
|
|
|
|
public function grants(): HasMany
|
|
{
|
|
return $this->hasMany(Grant::class);
|
|
}
|
|
}
|