]> BookStack Code Mirror - bookstack/blobdiff - app/Search/SearchApiController.php
Tests: Updated comment test to account for new editor usage
[bookstack] / app / Search / SearchApiController.php
index 28a3b53e6c3d512a211b00624b8ab9cf82a1d157..79cd8cfabd0e0166d082eb4c8eb8cc5e669f70d5 100644 (file)
@@ -9,21 +9,18 @@ use Illuminate\Http\Request;
 
 class SearchApiController extends ApiController
 {
-    protected SearchRunner $searchRunner;
-    protected SearchResultsFormatter $resultsFormatter;
-
     protected $rules = [
         'all' => [
             'query' => ['required'],
-            'page' => ['integer', 'min:1'],
+            'page'  => ['integer', 'min:1'],
             'count' => ['integer', 'min:1', 'max:100'],
         ],
     ];
 
-    public function __construct(SearchRunner $searchRunner, SearchResultsFormatter $resultsFormatter)
-    {
-        $this->searchRunner = $searchRunner;
-        $this->resultsFormatter = $resultsFormatter;
+    public function __construct(
+        protected SearchRunner $searchRunner,
+        protected SearchResultsFormatter $resultsFormatter
+    ) {
     }
 
     /**
@@ -50,7 +47,7 @@ class SearchApiController extends ApiController
         $this->resultsFormatter->format($results['results']->all(), $options);
 
         $data = (new ApiEntityListFormatter($results['results']->all()))
-            ->withType()->withTags()->withRelatedData()
+            ->withType()->withTags()->withParents()
             ->withField('preview_html', function (Entity $entity) {
                 return [
                     'name' => (string) $entity->getAttribute('preview_name'),