- return $this->hasMany(JointPermission::class, 'entity_id', 'entity_id')
- ->whereColumn('activities.entity_type', '=', 'joint_permissions.entity_type');
+ return $this->hasMany(JointPermission::class, 'entity_id', 'loggable_id')
+ ->whereColumn('activities.loggable_type', '=', 'joint_permissions.entity_type');