Loheide-eu-mitarbeiterplatt.../app/Http/Controllers/SearchController.php
Friederich Loheide 742eaa691f
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m36s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m32s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m1s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m54s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m16s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m15s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m38s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m33s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m15s
Suche ohne Begriff, scrollbare Dialoge auf dem Handy
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 21:09:03 +00:00

31 lines
1,002 B
PHP

<?php
namespace App\Http\Controllers;
use App\Search\GlobalSearch;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
class SearchController extends Controller
{
public function index(Request $request, GlobalSearch $search): Response
{
$query = trim((string) ($request->validate(['q' => ['nullable', 'string', 'max:100']])['q'] ?? ''));
return Inertia::render('Search/Index', [
'query' => $query,
'groups' => $search->run($request->user(), $query, 20),
'minLength' => GlobalSearch::MIN_LENGTH,
]);
}
/** Vorschläge für das Suchfeld in der Kopfzeile */
public function live(Request $request, GlobalSearch $search): JsonResponse
{
$query = trim((string) ($request->validate(['q' => ['nullable', 'string', 'max:100']])['q'] ?? ''));
return response()->json(['query' => $query, 'groups' => $search->run($request->user(), $query, 4)]);
}
}