Update (fix) search
This commit is contained in:
@@ -56,7 +56,7 @@ public function render($request, Throwable $exception)
|
|||||||
} elseif ($exception instanceof AuthenticationException) {
|
} elseif ($exception instanceof AuthenticationException) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
inspector()->reportException($exception);
|
//inspector()->reportException($exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
//default laravel response
|
//default laravel response
|
||||||
|
|||||||
@@ -36,11 +36,12 @@ public function search(Request $request)
|
|||||||
// For example, using MySQL's full-text search with MATCH...AGAINST
|
// For example, using MySQL's full-text search with MATCH...AGAINST
|
||||||
$posts = Post::with('category')
|
$posts = Post::with('category')
|
||||||
->where('status', 'publish')
|
->where('status', 'publish')
|
||||||
->whereRaw("to_tsvector('english', title || ' ' || bites) @@ to_tsquery('english', ?)", [$query])
|
->whereRaw("to_tsvector('english', title || ' ' || bites) @@ to_tsquery('english', ?)", [str_replace(' ', ' & ', $query)])
|
||||||
->where('published_at', '<=', now())
|
->where('published_at', '<=', now())
|
||||||
->orderBy('published_at', 'desc')
|
->orderBy('published_at', 'desc')
|
||||||
->cursorPaginate(10);
|
->cursorPaginate(10);
|
||||||
|
|
||||||
|
|
||||||
// breadcrumb json ld
|
// breadcrumb json ld
|
||||||
$listItems = [];
|
$listItems = [];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user