+
+ /**
+ * Get the user visible pages using the given image.
+ */
+ public function getPagesUsingImage(Image $image): array
+ {
+ $pages = Page::visible()
+ ->where('html', 'like', '%' . $image->url . '%')
+ ->get(['id', 'name', 'slug', 'book_id']);
+
+ foreach ($pages as $page) {
+ $page->setAttribute('url', $page->getUrl());
+ }
+
+ return $pages->all();
+ }