Skip to content

Commit

Permalink
Fixes logic error preventing multisite relation cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Jan 5, 2025
1 parent e8aca81 commit 4b34ed4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Database/Traits/Multisite.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,18 @@ protected function defineMultisiteRelations()
*/
public function canDeleteMultisiteRelation($name, $type = null): bool
{
// Attribute is exclusive to parent model without propagation
if (!$this->isAttributePropagatable($name)) {
return false;
return true;
}

if ($type === null) {
$type = $this->getRelationType($name);
}

// Type is not supported by multisite
if (!in_array($type, ['belongsToMany', 'morphToMany', 'morphedByMany', 'belongsTo', 'hasOne', 'hasMany', 'attachOne', 'attachMany'])) {
return false;
return true;
}

// The current record counts for one so halt if we find more
Expand Down

0 comments on commit 4b34ed4

Please sign in to comment.