@extends('admin.layout_admin.main') @section('css') @endsection @section('content') @php use Carbon\Carbon; $filters = []; if (request()->filled('q')) { $filters[] = 'Từ khóa: ' . e(request('q')) . ''; } if (request()->filled('filter_mode')) { $mode = request('filter_mode'); $label = match ($mode) { 'today' => 'Hôm nay', 'this_week' => 'Tuần này', 'this_month' => 'Tháng này', 'this_year' => 'Năm nay', default => null, }; if ($label) { $filters[] = 'Chế độ lọc: ' . $label . ''; } } if (request()->filled('status')) { $statusText = request('status') == '1' ? 'Hoạt động' : 'Ẩn'; $filters[] = 'Trạng thái: ' . $statusText . ''; } @endphp
@if (count($filters)) Tìm kiếm tin tức @else Danh sách tin tức @endif
@can('them-tin-tuc') @endcan @if (count($filters))

Kết quả tìm kiếm: {!! implode(', ', $filters) !!}

@endif @if ($news->count() > 0)
@can(['chinh-sua-tin-tuc', 'xoa-tin-tuc']) @endcan @foreach ($news as $key => $new) @endforeach
STT Tiêu đề Danh mục Trạng thái Người đăng Thời gianXử lý
{{ $news->firstItem() + $key }} {{ $new->title }} @if ($new->newsCategories->count() > 0) @foreach ($new->newsCategories as $category) {{ $category->name }} @endforeach @endif @if ($new->status == 1) Hoạt động @else Ẩn @endif {{ $new->poster->name }} {{ $new->created_at->format('H:i d/m/Y') }}
@can('chinh-sua-tin-tuc') @endcan @can('xoa-tin-tuc')
@method('DELETE') @csrf
@endcan
@else

Chưa có tin tức nào!

@endif
{{ $news->links() }}
@endsection @section('js') @endsection