mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Tags: Stopped recycle bin tags being counted on index
For #4892 Added test to cover.
This commit is contained in:
@ -207,6 +207,29 @@ class EntityProvider
|
||||
return $draftPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an entity to the recycle bin.
|
||||
*/
|
||||
public function sendToRecycleBin(Entity $entity)
|
||||
{
|
||||
$trash = app()->make(TrashCan::class);
|
||||
|
||||
if ($entity instanceof Page) {
|
||||
$trash->softDestroyPage($entity);
|
||||
} elseif ($entity instanceof Chapter) {
|
||||
$trash->softDestroyChapter($entity);
|
||||
} elseif ($entity instanceof Book) {
|
||||
$trash->softDestroyBook($entity);
|
||||
} elseif ($entity instanceof Bookshelf) {
|
||||
$trash->softDestroyBookshelf($entity);
|
||||
}
|
||||
|
||||
$entity->refresh();
|
||||
if (is_null($entity->deleted_at)) {
|
||||
throw new \Exception("Could not send entity type [{$entity->getMorphClass()}] to the recycle bin");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fully destroy the given entity from the system, bypassing the recycle bin
|
||||
* stage. Still runs through main app deletion logic.
|
||||
|
Reference in New Issue
Block a user