{{-- Command Palette — Cmd/Ctrl+K global search & navigation. Included once in layouts/app.blade.php; works on every page (logged in or out). Data sources: - Pages: App\Classes\Navigation::getLinks() + getAccountDropdownLinks() - Services: Auth::user()->services (active only, small set) - Servers: linked via services->server relation (best-effort; skipped if none) - Quick actions: hard-coded (toggle theme, logout, new ticket) --}} @php $cp_pages = []; foreach (\App\Classes\Navigation::getLinks() as $nav) { if (isset($nav['children']) && count($nav['children']) > 0) { foreach ($nav['children'] as $child) { try { $cp_pages[] = [ 'label' => $nav['name'] . ' / ' . $child['name'], 'href' => route($child['route'], $child['params'] ?? null), 'icon' => 'ri-arrow-right-line', 'section' => 'Pages', ]; } catch (\Throwable $e) {} } } elseif (isset($nav['route'])) { try { $cp_pages[] = [ 'label' => $nav['name'], 'href' => route($nav['route'], $nav['params'] ?? null), 'icon' => $nav['icon'] ?? 'ri-arrow-right-line', 'section' => 'Pages', ]; } catch (\Throwable $e) {} } } if (auth()->check()) { foreach (\App\Classes\Navigation::getAccountDropdownLinks() as $nav) { try { $cp_pages[] = [ 'label' => $nav['name'], 'href' => route($nav['route'], $nav['params'] ?? null), 'icon' => 'ri-user-line', 'section' => 'Account', ]; } catch (\Throwable $e) {} } // Services (current user, active) try { $cp_services = auth()->user()->services() ->where('status', 'active') ->limit(50) ->get(['id', 'name', 'product_id']); foreach ($cp_services as $svc) { $cp_pages[] = [ 'label' => $svc->name ?: ('Service #' . $svc->id), 'href' => route('services.show', ['service' => $svc->id]), 'icon' => 'ri-server-line', 'section' => 'Services', ]; } } catch (\Throwable $e) {} } // Quick actions (always present) $cp_pages[] = [ 'label' => 'Toggle dark mode', 'action' => 'toggleTheme', 'icon' => 'ri-contrast-2-line', 'section' => 'Quick actions', ]; if (auth()->check()) { try { $cp_pages[] = [ 'label' => 'New ticket', 'href' => route('tickets.create'), 'icon' => 'ri-mail-add-line', 'section' => 'Quick actions', ]; } catch (\Throwable $e) {} try { $cp_pages[] = [ 'label' => 'Invoices', 'href' => route('invoices'), 'icon' => 'ri-bill-line', 'section' => 'Quick actions', ]; } catch (\Throwable $e) {} } else { try { $cp_pages[] = [ 'label' => 'Login', 'href' => route('login'), 'icon' => 'ri-login-box-line', 'section' => 'Quick actions', ]; $cp_pages[] = [ 'label' => 'Register', 'href' => route('register'), 'icon' => 'ri-user-add-line', 'section' => 'Quick actions', ]; } catch (\Throwable $e) {} } @endphp
{{-- Backdrop + container --}}
{{-- Search input --}}
{{-- Results --}}
{{-- Footer hint --}}
↑↓ navigate ↵ select
⌘K to toggle
@once @endonce