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
+18
View File
@@ -13,12 +13,20 @@ class ContractTemplateObligation extends Model
protected $appends = [
'hash_id',
'user_hash_id',
'contract_template_hash_id',
'contract_template_list',
'contract_template_obligation_dependency_list',
'depend_contract_template_obligation_dependency_list',
'contract_template_obligation_contract_template_dependency_list'
];
protected $hidden = [
'id',
'user_id',
'contract_template_id'
];
public function contract_template()
{
return $this->belongsTo('App\Models\ContractTemplate', 'contract_template_id');
@@ -44,6 +52,16 @@ class ContractTemplateObligation extends Model
return Hasher::encode('contract_template_obligations', $this->id);
}
public function getUserHashIdAttribute()
{
return Hasher::encode('users', $this->user_id);
}
public function getContractTemplateHashIdAttribute()
{
return Hasher::encode('contract_templates', $this->contract_template_id);
}
public function getContractTemplateListAttribute()
{
return $this->contract_template()->get()->makeHidden(['contract_template_obligation_list']);