Skip to content

Commit

Permalink
Leaving morphToMany as untested for now
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Mar 15, 2024
1 parent 94c0c34 commit 81d825b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Database/Traits/Multisite.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function canDeleteMultisiteRelation($name, $type = null): bool
$type = $this->getRelationType($name);
}

if (!in_array($type, ['belongsToMany', 'belongsTo', 'hasOne', 'hasMany', 'attachOne', 'attachMany'])) {
if (!in_array($type, ['belongsToMany', 'morphedByMany', 'belongsTo', 'hasOne', 'hasMany', 'attachOne', 'attachMany'])) {
return false;
}

Expand All @@ -185,7 +185,7 @@ public function canDeleteMultisiteRelation($name, $type = null): bool
/**
* defineMultisiteRelation will modify defined relations on this model so they share
* their association using the shared identifier (`site_root_id`). Only these relation
* types support relation sharing: `belongsToMany`, `morphedByMany`, `morphToMany`,
* types support relation sharing: `belongsToMany`, `morphedByMany`,
* `belongsTo`, `hasOne`, `hasMany`, `attachOne`, `attachMany`.
*/
protected function defineMultisiteRelation($name, $type = null)
Expand All @@ -203,9 +203,6 @@ protected function defineMultisiteRelation($name, $type = null)
if (in_array($type, ['belongsToMany', 'morphedByMany'])) {
$this->$type[$name]['parentKey'] = 'site_root_id';
}
elseif (in_array($type, ['morphToMany'])) {
$this->$type[$name]['relatedKey'] = 'site_root_id';
}
elseif (in_array($type, ['belongsTo', 'hasOne', 'hasMany'])) {
$this->$type[$name]['otherKey'] = 'site_root_id';
}
Expand Down

0 comments on commit 81d825b

Please sign in to comment.