Skip to content

Commit 90fece2

Browse files
author
github-actions
committed
Merge pull request #1405 from hydephp/support-realtime-documentation-searches-in-realtime-compiler
Update realtime compiler to generate search indexes on demand hydephp/develop@e1535a4
1 parent 07a494f commit 90fece2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Routing/Router.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
use Hyde\RealtimeCompiler\Actions\AssetFileLocator;
99
use Hyde\RealtimeCompiler\Concerns\SendsErrorResponses;
1010
use Hyde\RealtimeCompiler\Models\FileObject;
11+
use Hyde\RealtimeCompiler\Concerns\InteractsWithLaravel;
12+
use Hyde\Framework\Actions\GeneratesDocumentationSearchIndex;
1113

1214
class Router
1315
{
1416
use SendsErrorResponses;
17+
use InteractsWithLaravel;
1518

1619
protected Request $request;
1720

@@ -71,6 +74,10 @@ protected function shouldProxy(Request $request): bool
7174
*/
7275
protected function proxyStatic(): Response
7376
{
77+
if ($this->request->path === '/docs/search.json') {
78+
$this->generateSearchIndex();
79+
}
80+
7481
$path = AssetFileLocator::find($this->request->path);
7582

7683
if ($path === null) {
@@ -86,4 +93,14 @@ protected function proxyStatic(): Response
8693
'Content-Length' => $file->getContentLength(),
8794
]);
8895
}
96+
97+
/**
98+
* Generate the documentation search index.
99+
*/
100+
protected function generateSearchIndex(): void
101+
{
102+
$this->bootApplication();
103+
104+
GeneratesDocumentationSearchIndex::handle();
105+
}
89106
}

0 commit comments

Comments
 (0)