- Hidden ID

This commit is contained in:
weiken.intex
2021-08-04 01:07:27 +08:00
parent 21944d9f3b
commit 69a0087ca6
8 changed files with 64 additions and 9 deletions
+7 -2
View File
@@ -11,10 +11,10 @@ class Contract extends Model
{
protected $table = 'contracts';
protected $appends = ['hash_id', 'contract_obligation_list', 'contract_entity_list'];
protected $appends = ['hash_id','user_hash_id', 'contract_obligation_list', 'contract_entity_list'];
protected $hidden = [
'id', 'in_time_contract_template',
'id','user_id', 'in_time_contract_template'
];
public function contract_obligation()
@@ -31,6 +31,11 @@ class Contract extends Model
{
return Hasher::encode('contracts', $this->id);
}
public function getUserHashIdAttribute()
{
return Hasher::encode('user', $this->user_id);
}
public function getContractObligationListAttribute()
{
+14 -2
View File
@@ -13,7 +13,9 @@ class ContractObligation extends Model
protected $appends = [
'hash_id',
'contract_hash_id',
'contract_hash_id',
'user_hash_id',
'contract_entity_hash_id',
'contract_list',
'contract_obligation_dependency_list',
'depend_contract_obligation_dependency_list',
@@ -22,7 +24,7 @@ class ContractObligation extends Model
];
protected $hidden = [
'in_time_contract_obligation_template',
'id','user_id','contract_entity_id','contract_id','in_time_contract_obligation_template',
];
public function contract()
@@ -59,6 +61,16 @@ class ContractObligation extends Model
{
return Hasher::encode('contracts', $this->contract_id);
}
public function getContractEntityHashIdAttribute()
{
return Hasher::encode('contract_entities', $this->contract_entity_id);
}
public function getUserHashIdAttribute()
{
return Hasher::encode('user', $this->user_id);
}
public function getContractListAttribute()
{
+10 -1
View File
@@ -11,7 +11,11 @@ class ContractTemplate extends Model
{
protected $table = 'contract_templates';
protected $appends = ['hash_id', 'contract_template_obligation_list'];
protected $appends = ['hash_id','user_hash_id', 'contract_template_obligation_list'];
protected $hidden = [
'id','user_id'
];
public function contract_template_obligation()
{
@@ -22,6 +26,11 @@ class ContractTemplate extends Model
{
return Hasher::encode('contract_templates', $this->id);
}
public function getUserHashIdAttribute()
{
return Hasher::encode('user', $this->user_id);
}
public function getContractTemplateObligationListAttribute()
{
+17 -1
View File
@@ -13,11 +13,17 @@ class ContractTemplateObligation extends Model
protected $appends = [
'hash_id',
'contract_template_hash_id',
'user_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','contract_template_id','user_id',
];
public function contract_template()
{
@@ -43,7 +49,17 @@ class ContractTemplateObligation extends Model
{
return Hasher::encode('contract_template_obligations', $this->id);
}
public function getContractTemplateHashIdAttribute()
{
return Hasher::encode('contract_template', $this->contract_template_id);
}
public function getUserHashIdAttribute()
{
return Hasher::encode('user', $this->user_id);
}
public function getContractTemplateListAttribute()
{
return $this->contract_template()->get()->makeHidden(['contract_template_obligation_list']);
+10 -1
View File
@@ -11,7 +11,11 @@ class Entity extends Model
{
protected $table = 'entities';
protected $appends = ['hash_id', 'entity_signature_list'];
protected $appends = ['hash_id','user_hash_id', 'entity_signature_list'];
protected $hidden = [
'id','user_id',
];
public function entity_signature()
{
@@ -22,6 +26,11 @@ class Entity extends Model
{
return Hasher::encode('entities', $this->id);
}
public function getUserHashIdAttribute()
{
return Hasher::encode('user', $this->user_id);
}
public function getEntitySignatureListAttribute()
{
+4
View File
@@ -12,6 +12,10 @@ class EntitySignature extends Model
protected $table = 'entity_signatures';
protected $appends = ['hash_id', 'entity_list'];
protected $hidden = [
'id'
];
public function entity()
{
+1 -1
View File
@@ -17,7 +17,7 @@ class Role extends Model
protected $appends = ['hash_id', 'permission_list'];
protected $hidden = [
'pivot'
'id','pivot'
];
public function getAllPermissions()
+1 -1
View File
@@ -25,7 +25,7 @@ class User extends Authenticatable
];
protected $hidden = [
'password',
'id','password',
];
protected $appends = ['hash_id', 'role_list', 'permission_list'];