{{-- filepath: resources/views/search_results.blade.php --}} @php $query = request('q', $query ?? ''); $safeQuery = e($query); $sections = [ 'courses' => $courses ?? collect(), 'news' => $news ?? collect(), ]; $total = $sections['courses']->count() + $sections['news']->count(); function highlight_fragment($text, $q) { if (!$q) return e($text); return preg_replace('/(' . preg_quote($q, '/') . ')/iu', '$1', e($text)); } @endphp {{-- Hero Section --}}

Kết quả tìm kiếm

Từ khóa: "{{ $safeQuery }}" @if($query) {{ $total }} kết quả @endif

{{-- Search Form --}} {{-- Filter Buttons --}}
{{-- Results Section --}}
@if($total === 0) @endif {{-- Courses Section --}} @if($sections['courses']->count())

Khóa học

Tìm thấy {{ $sections['courses']->count() }} khóa học phù hợp

@foreach($sections['courses'] as $course)
{{-- Image --}}
{{ $course->title }} {{ $course->category->name }}
{{-- Content --}}
{!! highlight_fragment($course->title, $query) !!}
{{-- Meta Info --}}
@if ($course->start_date)
Khai giảng: {{ $course->start_date->format('d/m/Y') }}
@endif @if ($course->end_registration_date)
Hạn đăng ký: {{ $course->end_registration_date->format('d/m/Y') }}
@endif
{{-- Description --}}

{{ Str::limit($course->short_description ?? $course->description, 100) }}

{{-- Price --}}
@if ($course->is_price_visible) {{ number_format($course->price, 0, ',', '.') }} VNĐ/{{ App\Helpers\SettingHelper::get('course_unit', 'khóa') }} @else Liên hệ để biết giá @endif
{{-- Button --}} Xem chi tiết
@endforeach
@endif {{-- News Section --}} @if($sections['news']->count())

Tin tức

Tìm thấy {{ $sections['news']->count() }} bài viết phù hợp

@foreach($sections['news'] as $item)
{{-- Image --}}
{{ $item->title }} {{ $item->news_category->name }}
{{-- Content --}}
{{ $item->published_at?->format('d/m/Y') }}
{!! highlight_fragment($item->title, $query) !!}

{{ Str::limit(strip_tags($item->summary ?? $item->content), 100) }}

{{-- Stats --}}
{{ $item->view_count ?? 0 }} lượt xem
{{-- Button --}} Xem thêm
@endforeach
@endif
{{-- Filter Script --}}