feat: extend rate card profiles with brands, terms, and custom HTML, and remove search bar from search index view

This commit is contained in:
I-Fun
2026-04-05 18:28:48 +07:00
parent d6b10f725b
commit 1c2c10d253
22 changed files with 1024 additions and 388 deletions

View File

@@ -17,7 +17,7 @@ class SearchController extends Controller
{
public function index(Request $request): View
{
$q = trim($request->get('q', ''));
$q = trim((string) $request->get('q', ''));
$results = $q ? $this->search($q) : [];
return view('search.index', compact('q', 'results'));
@@ -26,7 +26,7 @@ class SearchController extends Controller
/** Quick AJAX endpoint — returns grouped results for the dropdown */
public function quick(Request $request): JsonResponse
{
$q = trim($request->get('q', ''));
$q = trim((string) $request->get('q', ''));
if (strlen($q) < 2) {
return response()->json([]);
@@ -138,6 +138,24 @@ class SearchController extends Controller
];
}
// ── Notes ───────────────────────────────────────────
$notes = \App\Models\Note::where('title', 'LIKE', $like)
->orWhere('content', 'LIKE', $like)
->limit($limit)->get();
if ($notes->isNotEmpty()) {
$groups[] = [
'type' => 'notes',
'label' => '📝 Notes',
'items' => $notes->map(fn ($n) => [
'icon' => '📝',
'title' => $n->title ?: 'Untitled',
'subtitle' => 'Notes Management',
'url' => route('notes.index'),
])->values()->all(),
];
}
return $groups;
}
}