Snapshot of main at 9f39a6e1e (2026-11-02)
This commit is contained in:
commit
6ccf1792d7
2580 files changed
+1040202
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class SearchController extends Controller
|
||||
{
|
||||
public function show(Request $request)
|
||||
{
|
||||
$authId = Auth::guard('web')->id();
|
||||
$key = 'main_search_bar_results_' . $authId;
|
||||
|
||||
// When arriving via a category badge link, clear any stale cache so the
|
||||
// MainBrowseTagCategories component can run a fresh search on mount.
|
||||
if ($request->query('category')) {
|
||||
cache()->forget($key);
|
||||
}
|
||||
|
||||
$data = cache()->get($key, ['results' => [], 'searchTerm' => null, 'total' => 0,]);
|
||||
$resultRefs = $data['results'];
|
||||
$searchTerm = $data['searchTerm'];
|
||||
$total = $data['total'];
|
||||
|
||||
|
||||
// empty cache when retrieved
|
||||
// cache()->forget($key);
|
||||
|
||||
return view('search.show', [
|
||||
'resultRefs' => $resultRefs,
|
||||
'searchTerm' => $searchTerm,
|
||||
'total' => $total,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user