55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Entitlement;
|
|
|
|
use App\Domain\Catalog\ArticleRelease;
|
|
use App\Domain\Catalog\LicenseArticle;
|
|
use App\Domain\Catalog\RightsProfileVersion;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Grant extends Model
|
|
{
|
|
protected $fillable = [
|
|
'acquisition_id',
|
|
'license_article_id',
|
|
'rights_profile_version_id',
|
|
'rights_snapshot',
|
|
'valid_from',
|
|
'valid_until',
|
|
'release_at_grant_id',
|
|
'status',
|
|
'status_reason',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'rights_snapshot' => 'array',
|
|
'valid_from' => 'datetime',
|
|
'valid_until' => 'datetime',
|
|
'status' => GrantStatus::class,
|
|
];
|
|
}
|
|
|
|
public function acquisition(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Acquisition::class);
|
|
}
|
|
|
|
public function article(): BelongsTo
|
|
{
|
|
return $this->belongsTo(LicenseArticle::class, 'license_article_id');
|
|
}
|
|
|
|
public function rights(): BelongsTo
|
|
{
|
|
return $this->belongsTo(RightsProfileVersion::class, 'rights_profile_version_id');
|
|
}
|
|
|
|
public function releaseAtGrant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ArticleRelease::class, 'release_at_grant_id');
|
|
}
|
|
}
|