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
+15 -1
View File
@@ -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']);