use BookStack\Entities\Models\Entity;
use BookStack\Entities\Models\HasCoverImage;
use BookStack\Entities\Models\Page;
+use BookStack\Entities\Queries\EntityQueries;
use BookStack\Exceptions\NotifyException;
use BookStack\Facades\Activity;
use BookStack\Uploads\AttachmentService;
class TrashCan
{
+ public function __construct(
+ protected EntityQueries $queries,
+ ) {
+ }
+
/**
* Send a shelf to the recycle bin.
*
}
// Remove book template usages
- Book::query()->where('default_template_id', '=', $page->id)
+ $this->queries->books->start()
+ ->where('default_template_id', '=', $page->id)
->update(['default_template_id' => null]);
- $page->forceDelete();
-
// Remove chapter template usages
- Chapter::query()->where('default_template_id', '=', $page->id)
+ $this->queries->chapters->start()
+ ->where('default_template_id', '=', $page->id)
->update(['default_template_id' => null]);
$page->forceDelete();