]> BookStack Code Mirror - bookstack/blobdiff - app/Actions/TagRepo.php
Done a refactor pass on PermissionService
[bookstack] / app / Actions / TagRepo.php
index f58589ccd589c4d019d055156f8596974da447c4..c80e8abe3225e70a121aca5d21873ec1fda1a6a7 100644 (file)
@@ -26,7 +26,9 @@ class TagRepo
      */
     public function getNameSuggestions(?string $searchTerm): Collection
     {
-        $query = $this->tag->select('*', DB::raw('count(*) as count'))->groupBy('name');
+        $query = $this->tag->newQuery()
+            ->select('*', DB::raw('count(*) as count'))
+            ->groupBy('name');
 
         if ($searchTerm) {
             $query = $query->where('name', 'LIKE', $searchTerm . '%')->orderBy('name', 'desc');
@@ -45,7 +47,9 @@ class TagRepo
      */
     public function getValueSuggestions(?string $searchTerm, ?string $tagName): Collection
     {
-        $query = $this->tag->select('*', DB::raw('count(*) as count'))->groupBy('value');
+        $query = $this->tag->newQuery()
+            ->select('*', DB::raw('count(*) as count'))
+            ->groupBy('value');
 
         if ($searchTerm) {
             $query = $query->where('value', 'LIKE', $searchTerm . '%')->orderBy('value', 'desc');