- return $this->returnPaginated($images, $page, $pageSize);
- }
-
- /**
- * Search for images by query, of a particular type.
- * @param string $type
- * @param int $page
- * @param int $pageSize
- * @param string $searchTerm
- * @return array
- */
- public function searchPaginatedByType(Request $request, $type, $searchTerm, $page = 0, $pageSize = 24)
- {
- // TODO - Filter by uploaded_to
- $images = $this->image->newQuery()
- ->where('type', '=', strtolower($type))
- ->where('name', 'LIKE', '%' . $searchTerm . '%');
+ // Filter by page access
+ $imageQuery = $this->restrictionService->filterRelatedEntity(Page::class, $imageQuery, 'images', 'uploaded_to');