mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-29 23:54:05 +08:00
Removed "isA" usages from trashcan
This commit is contained in:
parent
cc5d0ef4cf
commit
61a911dd39
@ -273,11 +273,11 @@ class TrashCan
|
|||||||
$count++;
|
$count++;
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($entity->isA('chapter') || $entity->isA('book')) {
|
if ($entity instanceof Chapter || $entity instanceof Book) {
|
||||||
$entity->pages()->withTrashed()->withCount('deletions')->get()->each($restoreAction);
|
$entity->pages()->withTrashed()->withCount('deletions')->get()->each($restoreAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($entity->isA('book')) {
|
if ($entity instanceof Book) {
|
||||||
$entity->chapters()->withTrashed()->withCount('deletions')->get()->each($restoreAction);
|
$entity->chapters()->withTrashed()->withCount('deletions')->get()->each($restoreAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,19 +286,20 @@ class TrashCan
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy the given entity.
|
* Destroy the given entity.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function destroyEntity(Entity $entity): int
|
protected function destroyEntity(Entity $entity): int
|
||||||
{
|
{
|
||||||
if ($entity->isA('page')) {
|
if ($entity instanceof Page) {
|
||||||
return $this->destroyPage($entity);
|
return $this->destroyPage($entity);
|
||||||
}
|
}
|
||||||
if ($entity->isA('chapter')) {
|
if ($entity instanceof Chapter) {
|
||||||
return $this->destroyChapter($entity);
|
return $this->destroyChapter($entity);
|
||||||
}
|
}
|
||||||
if ($entity->isA('book')) {
|
if ($entity instanceof Book) {
|
||||||
return $this->destroyBook($entity);
|
return $this->destroyBook($entity);
|
||||||
}
|
}
|
||||||
if ($entity->isA('bookshelf')) {
|
if ($entity instanceof Bookshelf) {
|
||||||
return $this->destroyShelf($entity);
|
return $this->destroyShelf($entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user