This commit is contained in:
glovetleong
2021-08-05 14:01:33 +08:00
parent 9f5224bc73
commit e3b6c69718
17 changed files with 215 additions and 26 deletions
+22
View File
@@ -13,7 +13,9 @@ class ContractObligation extends Model
protected $appends = [
'hash_id',
'user_hash_id',
'contract_hash_id',
'contract_template_obligation_hash_id',
'contract_list',
'contract_obligation_dependency_list',
'depend_contract_obligation_dependency_list',
@@ -22,6 +24,11 @@ class ContractObligation extends Model
];
protected $hidden = [
'id',
'user_id',
'contract_id',
'contract_template_obligation_id',
'contract_entity_id',
'in_time_contract_obligation_template',
];
@@ -55,11 +62,26 @@ class ContractObligation extends Model
return Hasher::encode('contract_obligations', $this->id);
}
public function getUserHashIdAttribute()
{
return Hasher::encode('users', $this->user_id);
}
public function getContractHashIdAttribute()
{
return Hasher::encode('contracts', $this->contract_id);
}
public function getContractTemplateObligationHashIdAttribute()
{
return Hasher::encode('contract_template_obligations', $this->contract_template_obligation_id);
}
public function getContractEntityHashIdAttribute()
{
return Hasher::encode('contract_entities', $this->contract_entity_id);
}
public function getContractListAttribute()
{
return $this->contract()->get()->makeHidden(['contract_obligation_list']);