@extends('layouts.user') @section('title', trans('app.Search Knowledge Base')) @section('page-title', trans('app.Search Knowledge Base')) @section('page-subtitle', trans('app.Find answers to your questions')) @php // Helper function to highlight search terms function highlightSearchTerm($text, $query) { if (empty($query)) return $text; return preg_replace('/(' . preg_quote($query, '/') . ')/i', '$1', $text); } @endphp @section('content')

{{ trans('app.Search Knowledge Base') }}

{{ trans('app.Find answers to your questions and get help with our products') }}

@if($q === '')

{{ trans('app.Browse by Category') }}

{{ trans('app.Explore our knowledge base categories') }}

@foreach($categoriesWithAccess as $cat)

{{ $cat->name }}

@if($cat->is_featured) {{ trans('app.Premium') }} @endif @if($cat->requires_serial || $cat->product_id) @if($cat->hasAccess) {{ trans('app.Accessible') }} @else {{ trans('app.Locked') }} @endif @endif

{{ Str::limit($cat->description, 120) }}

{{ $cat->articles->count() }} {{ trans('app.articles') }}
@endforeach
@else

{{ trans('app.Search results') }}

@if($results->count() > 0) {{ $results->count() }} {{ trans('app.results for') }} "{{ $q }}" @else {{ trans('app.No results for') }} "{{ $q }}" @endif

@if($results->count() > 0)
@foreach($resultsWithAccess as $item)
@if($item->search_type === 'article') @else @endif

@if($item->search_type === 'article') @if($item->hasAccess) {!! highlightSearchTerm($item->title, $highlightQuery) !!} @else {!! highlightSearchTerm($item->title, $highlightQuery) !!} @endif @else @if($item->hasAccess) {!! highlightSearchTerm($item->name, $highlightQuery) !!} @else {!! highlightSearchTerm($item->name, $highlightQuery) !!} @endif @endif

@if($item->search_type === 'article') {{ trans('app.Article') }} @else {{ trans('app.Category') }} @endif @if($item->is_featured) {{ trans('app.Premium') }} @endif @if($item->search_type === 'article' && $item->allow_comments) {{ trans('app.Comments Enabled') }} @endif @if(!$item->hasAccess) @if(auth()->check()) {{ trans('app.Locked') }} @else {{ trans('app.Login Required') }} @endif @endif

@if($item->search_type === 'article') {!! highlightSearchTerm(Str::limit($item->excerpt ?: strip_tags($item->content), 200), $highlightQuery) !!} @else {!! highlightSearchTerm(Str::limit($item->description, 200), $highlightQuery) !!} @endif

@if(!$item->hasAccess)

@if(auth()->check()) {{ trans('app.This content requires a valid license to access') }} @else {{ trans('app.Please login to access this content') }} @endif

@endif
@endforeach
@if($results->count() > 10) @endif @else

{{ trans('app.No results found') }}

{{ trans('app.We couldn\'t find any articles matching your search. Try different keywords or browse our categories below.') }}

{{ trans('app.Search Tips') }}

  • {{ trans('app.Try different keywords') }}
  • {{ trans('app.Check your spelling') }}
  • {{ trans('app.Use more general terms') }}
  • {{ trans('app.Try fewer keywords') }}
@endif
@if($q !== '' && $results->count() > 0) @endif @endif
@endsection