+
+ /**
+ * Load some related details for the deletion listing.
+ */
+ protected function listFormatter(Deletion $deletion)
+ {
+ $deletable = $deletion->deletable;
+ $withTrashedQuery = fn (Builder $query) => $query->withTrashed();
+
+ if ($deletable instanceof BookChild) {
+ $parent = $deletable->getParent();
+ $parent->setAttribute('type', $parent->getType());
+ $deletable->setRelation('parent', $parent);
+ }
+
+ if ($deletable instanceof Book || $deletable instanceof Chapter) {
+ $countsToLoad = ['pages' => $withTrashedQuery];
+ if ($deletable instanceof Book) {
+ $countsToLoad['chapters'] = $withTrashedQuery;
+ }
+ $deletable->loadCount($countsToLoad);
+ }
+ }
+}