fix: Use slug for Document route model binding

- Add getRouteKeyName() to return 'slug' for Document model
- Add resolveRouteBinding() to support both slug and ID lookups
- Update QuickSwitcher to use slug instead of ID
- Update quick-switcher blade to use slug in routes

This ensures URLs use readable slugs (e.g., /documents/home)
while maintaining backwards compatibility with ID-based URLs
This commit is contained in:
2025-11-29 17:22:17 +09:00
parent 893d3c7a69
commit ac56889a87
3 changed files with 35 additions and 4 deletions

View File

@@ -68,7 +68,7 @@ class="w-full pl-10 pr-4 py-3 border-0 focus:ring-0 text-lg"
@foreach($this->results as $index => $result)
<li>
<a
href="{{ route('documents.show', $result['id']) }}"
href="{{ route('documents.show', $result['slug']) }}"
class="block px-4 py-3 hover:bg-gray-50 transition {{ $index === $selectedIndex ? 'bg-indigo-50' : '' }}"
wire:navigate
@click="open = false"