morphTo('from'); } public function to(): MorphTo { return $this->morphTo('to'); } public function jointPermissions(): HasMany { return $this->hasMany(JointPermission::class, 'entity_id', 'from_id') ->whereColumn('references.from_type', '=', 'joint_permissions.entity_type'); } }