From: Vincent Vanwaelscappel Date: Tue, 19 Oct 2021 18:21:12 +0000 (+0200) Subject: wip #4804 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=93e7567ac94322baa6e8c84dad96047def8411b9;p=odl.git wip #4804 @0.25 --- diff --git a/app/Console/Commands/SearchIndex.php b/app/Console/Commands/SearchIndex.php new file mode 100644 index 0000000..b3bfb36 --- /dev/null +++ b/app/Console/Commands/SearchIndex.php @@ -0,0 +1,17 @@ +output = storage_path('search.js'); + } + + public function handle() + { + $this->indexHome(); + $this->indexLibrary(); + $this->indexResources(); + $this->indexTour(); + + parent::handle(); + } + + public function indexHome() + { + + } + + public function indexLibrary() + { + + } + + public function indexResources() + { + /** @var PageData $data */ + $data = Resource::find('1')->getPageData(); + + $chapters = $data->get('chapters'); + foreach ($chapters as $i => $chapter) { + foreach ($chapter['subchapters'] as $j => $subchapter) { + foreach ($subchapter['subchapter_memos'] as $k => $memo) { + if (!$memo['memo_pdf']) { + continue; + } + foreach ($data->getMediaPathsByCollection($memo['memo_pdf']) as $pdf) { + $document = new PDF($pdf); + $document->setId('resources_' . $i . '_' . $j . '_' . $k); + $document->setUrl('resources_' . $i . '_' . $j . '_' . $k); + $document->setTitle($memo['memo_title']); + $document->setThumb($data->getImageURLbyCollection($memo['memo_image'])); + $document->setType('pdf'); + $this->addDocument($document); + break; + } + + } + } + } + + } + + public function indexTour() + { + + } + +} diff --git a/composer.json b/composer.json index 76345cd..b572211 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,10 @@ "name": "odl/cube", "type": "project", "description": "ODL Framework.", - "keywords": ["framework", "laravel"], + "keywords": [ + "framework", + "laravel" + ], "repositories": [ { "type": "composer", @@ -18,6 +21,7 @@ "ext-tidy": "*", "ext-zip": "*", "cubist/cms-back": "dev-master", + "cubist/minisearch": "dev-master", "cubist/socialite": "dev-master", "fluidbook/tools": "dev-master", "fruitcake/laravel-cors": "^2.0",