Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Mar 29, 2024
1 parent 49ce61b commit e6fb9f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/Http/Controllers/DocsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@ public function status(string $version = Docs::DEFAULT_VERSION)
}

/**
* @param string $versionOfDocs
* @param string $version
* @param \Illuminate\Http\Request $request
*
* @return \HotwiredLaravel\TurboLaravel\Http\MultiplePendingTurboStreamResponse|\HotwiredLaravel\TurboLaravel\Http\PendingTurboStreamResponse
*/
public function search(string $versionOfDocs, Request $request)
public function search(string $version, Request $request)
{
$searchOffers = [];

if ($request->filled('text')) {
$searchOffers = DocumentationSection::search($request->text)
->where('version', $versionOfDocs)
->where('version', $version)
->orderBy('level')
->get()
->take(6);
Expand Down
5 changes: 4 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@
->whereIn('version', Docs::SUPPORT_VERSIONS)
->name('docs');

Route::post('/docs/{versionOfDocs}/search', [DocsController::class, 'search'])->name('docs.search');
Route::post('/docs/{version}/search', [DocsController::class, 'search'])
->whereIn('version', Docs::SUPPORT_VERSIONS)
->name('docs.search');

Route::get('/docs/{page}', fn (string $page) => redirect()->route('docs', ['version' => Docs::DEFAULT_VERSION, 'page' => $page]));

Route::get('nav/docs/{version?}', [DocsController::class, 'navigation'])
Expand Down

0 comments on commit e6fb9f4

Please sign in to comment.