diff --git a/app/Models/Admin.php b/app/Models/Admin.php index 3fddd06..1771e31 100644 --- a/app/Models/Admin.php +++ b/app/Models/Admin.php @@ -21,11 +21,15 @@ class Admin extends Authenticatable protected $table = 'admins'; protected $fillable = [ - 'name', 'email', 'password', + 'id', + 'name', + 'email', + 'password' ]; protected $hidden = [ - 'password', 'pivot' + 'password', + 'pivot' ]; protected $appends = ['hash_id', 'role_list', 'permission_list']; diff --git a/app/Models/Contract.php b/app/Models/Contract.php index 82ddfac..651c1c9 100644 --- a/app/Models/Contract.php +++ b/app/Models/Contract.php @@ -11,10 +11,19 @@ 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_template_hash_id', + 'contract_obligation_list', + 'contract_entity_list' + ]; protected $hidden = [ - 'id', 'in_time_contract_template', + 'id', + 'user_id', + 'contract_template_id', + 'in_time_contract_template' ]; public function contract_obligation() @@ -32,6 +41,16 @@ class Contract extends Model return Hasher::encode('contracts', $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 getContractObligationListAttribute() { return $this->contract_obligation()->get()->makeHidden(['contract_list']); diff --git a/app/Models/ContractEntity.php b/app/Models/ContractEntity.php index 69cccde..c810bfa 100644 --- a/app/Models/ContractEntity.php +++ b/app/Models/ContractEntity.php @@ -11,7 +11,11 @@ class ContractEntity extends Model { protected $table = 'contract_entities'; - protected $appends = ['hash_id', 'entity_signature_hash_id', 'contract_list', 'entity_list']; + protected $appends = ['hash_id', 'user_hash_id', 'contract_hash_id', 'entity_hash_id', 'entity_signature_hash_id', 'contract_list', 'entity_list']; + + protected $hidden = [ + 'id', 'user_id', 'contract_id', 'entity_id', 'entity_sinature_id', + ]; public function contract() { @@ -28,6 +32,21 @@ class ContractEntity extends Model return Hasher::encode('contract_entities', $this->id); } + public function getUserHashIdAttribute() + { + return Hasher::encode('users', $this->user_id); + } + + public function getContractHashIdAttribute() + { + return Hasher::encode('contracts', $this->contract_id); + } + + public function getEntityHashIdAttribute() + { + return Hasher::encode('entities', $this->entity_id); + } + public function getEntitySignatureHashIdAttribute() { return Hasher::encode('entity_signatures', $this->entity_signature_id); diff --git a/app/Models/ContractObligation.php b/app/Models/ContractObligation.php index facecbf..7b37592 100644 --- a/app/Models/ContractObligation.php +++ b/app/Models/ContractObligation.php @@ -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']); diff --git a/app/Models/ContractObligationContractDependency.php b/app/Models/ContractObligationContractDependency.php index 56bbed1..1018c38 100644 --- a/app/Models/ContractObligationContractDependency.php +++ b/app/Models/ContractObligationContractDependency.php @@ -13,12 +13,21 @@ class ContractObligationContractDependency extends Model protected $appends = [ 'hash_id', + 'user_hash_id', 'contract_obligation_hash_id', 'depend_contract_hash_id', 'contract_obligation_list', 'depend_contract_list' ]; + protected $hidden = [ + 'id', + 'user_id', + 'contract_id', + 'contract_obligation_id', + 'depend_contract_id', + ]; + public function contract_obligation() { return $this->belongsTo('App\Models\ContractObligation', 'contract_obligation_id'); @@ -34,6 +43,11 @@ class ContractObligationContractDependency extends Model return Hasher::encode('contract_obligation_contract_dependencies', $this->id); } + public function getUserHashIdAttribute() + { + return Hasher::encode('users', $this->user_id); + } + public function getContractObligationHashIdAttribute() { return Hasher::encode('contract_obligations', $this->contract_obligation_id); diff --git a/app/Models/ContractObligationDependency.php b/app/Models/ContractObligationDependency.php index 5d20126..b3fe71b 100644 --- a/app/Models/ContractObligationDependency.php +++ b/app/Models/ContractObligationDependency.php @@ -19,6 +19,13 @@ class ContractObligationDependency extends Model 'depend_contract_obligation_list' ]; + protected $hidden = [ + 'id', + 'user_id', + 'contract_obligation_id', + 'depend_contract_obligation_id', + ]; + public function contract_obligation() { return $this->belongsTo('App\Models\ContractObligation', 'contract_obligation_id'); diff --git a/app/Models/ContractTemplate.php b/app/Models/ContractTemplate.php index fa8bd5e..20b7590 100644 --- a/app/Models/ContractTemplate.php +++ b/app/Models/ContractTemplate.php @@ -11,7 +11,16 @@ 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() { @@ -23,6 +32,11 @@ class ContractTemplate extends Model return Hasher::encode('contract_templates', $this->id); } + public function getUserHashIdAttribute() + { + return Hasher::encode('users', $this->user_id); + } + public function getContractTemplateObligationListAttribute() { return $this->contract_template_obligation() diff --git a/app/Models/ContractTemplateObligation.php b/app/Models/ContractTemplateObligation.php index 23c9d52..cc62811 100644 --- a/app/Models/ContractTemplateObligation.php +++ b/app/Models/ContractTemplateObligation.php @@ -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']); diff --git a/app/Models/ContractTemplateObligationContractTemplateDependency.php b/app/Models/ContractTemplateObligationContractTemplateDependency.php index 9a99307..f7aeb25 100644 --- a/app/Models/ContractTemplateObligationContractTemplateDependency.php +++ b/app/Models/ContractTemplateObligationContractTemplateDependency.php @@ -13,12 +13,20 @@ class ContractTemplateObligationContractTemplateDependency extends Model protected $appends = [ 'hash_id', + 'user_hash_id', 'contract_template_obligation_hash_id', 'depend_contract_template_hash_id', 'contract_template_obligation_list', 'depend_contract_template_list' ]; + protected $hidden = [ + 'id', + 'user_id', + 'contract_template_obligation_id', + 'depend_contract_template_id' + ]; + public function contract_template_obligation() { return $this->belongsTo('App\Models\ContractTemplateObligation', 'contract_template_obligation_id'); @@ -34,6 +42,11 @@ class ContractTemplateObligationContractTemplateDependency extends Model return Hasher::encode('contract_template_obligation_contract_template_dependencies', $this->id); } + public function getUserHashIdAttribute() + { + return Hasher::encode('users', $this->user_id); + } + public function getContractTemplateObligationHashIdAttribute() { return Hasher::encode('contract_template_obligations', $this->contract_template_obligation_id); diff --git a/app/Models/ContractTemplateObligationDependency.php b/app/Models/ContractTemplateObligationDependency.php index 19f2c5a..14799bd 100644 --- a/app/Models/ContractTemplateObligationDependency.php +++ b/app/Models/ContractTemplateObligationDependency.php @@ -13,12 +13,20 @@ class ContractTemplateObligationDependency extends Model protected $appends = [ 'hash_id', + 'user_hash_id', 'contract_template_obligation_hash_id', 'depend_contract_template_obligation_hash_id', 'contract_template_obligation_list', 'depend_contract_template_obligation_list' ]; + protected $hidden = [ + 'id', + 'user_id', + 'contract_template_obligation_id', + 'depend_contract_template_obligation_id' + ]; + public function contract_template_obligation() { return $this->belongsTo('App\Models\ContractTemplateObligation', 'contract_template_obligation_id'); @@ -34,6 +42,11 @@ class ContractTemplateObligationDependency extends Model return Hasher::encode('contract_template_obligation_dependencies', $this->id); } + public function getUserHashIdAttribute() + { + return Hasher::encode('users', $this->user_id); + } + public function getContractTemplateObligationHashIdAttribute() { return Hasher::encode('contract_template_obligations', $this->contract_template_obligation_id); diff --git a/app/Models/Entity.php b/app/Models/Entity.php index 93101f2..8cfdb13 100644 --- a/app/Models/Entity.php +++ b/app/Models/Entity.php @@ -11,7 +11,16 @@ class Entity extends Model { protected $table = 'entities'; - protected $appends = ['hash_id', 'entity_signature_list']; + protected $appends = [ + 'hash_id', + 'user_id', + 'entity_signature_list' + ]; + + protected $hidden = [ + 'id', + 'user_id', + ]; public function entity_signature() { @@ -23,6 +32,11 @@ class Entity extends Model return Hasher::encode('entities', $this->id); } + public function getUserHashIdAttribute() + { + return Hasher::encode('users', $this->user_id); + } + public function getEntitySignatureListAttribute() { return $this->entity_signature()->get()->makeHidden(['entity_list']); diff --git a/app/Models/EntitySignature.php b/app/Models/EntitySignature.php index bbfcb74..d7eadd4 100644 --- a/app/Models/EntitySignature.php +++ b/app/Models/EntitySignature.php @@ -11,7 +11,16 @@ class EntitySignature extends Model { protected $table = 'entity_signatures'; - protected $appends = ['hash_id', 'entity_list']; + protected $appends = [ + 'hash_id', + 'entity_hash_id', + 'entity_list' + ]; + + protected $hidden = [ + 'id', + 'entity_id', + ]; public function entity() { @@ -23,6 +32,11 @@ class EntitySignature extends Model return Hasher::encode('entity_signatures', $this->id); } + public function getEntityHashIdAttribute() + { + return Hasher::encode('entities', $this->entity_id); + } + public function getEntityListAttribute() { return $this->entity()->get()->makeHidden(['entity_signature_list']); diff --git a/app/Models/Permission.php b/app/Models/Permission.php index f0c86f9..890763b 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -15,7 +15,13 @@ class Permission extends Model 'pivot' ]; - protected $appends = ['hash_id']; + protected $appends = [ + 'hash_id' + ]; + + protected $hidden = [ + 'id', + ]; public function getHashIdAttribute() { diff --git a/app/Models/Role.php b/app/Models/Role.php index d8d94cc..0246c4c 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -17,6 +17,7 @@ class Role extends Model protected $appends = ['hash_id', 'permission_list']; protected $hidden = [ + 'id', 'pivot' ]; diff --git a/app/Models/User.php b/app/Models/User.php index 690e308..348218e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -24,11 +24,16 @@ class User extends Authenticatable 'name', 'email', 'password', ]; - protected $hidden = [ - 'password', + protected $appends = [ + 'hash_id', + 'role_list', + 'permission_list' ]; - protected $appends = ['hash_id', 'role_list', 'permission_list']; + protected $hidden = [ + 'id', + 'password' + ]; public function getHashIdAttribute() { diff --git a/resources/js/user/pages/contract-templates/Table.vue b/resources/js/user/pages/contract-templates/Table.vue index 043f085..0576433 100644 --- a/resources/js/user/pages/contract-templates/Table.vue +++ b/resources/js/user/pages/contract-templates/Table.vue @@ -46,12 +46,17 @@