@if ($CategoryAttribute->count() > 0) @foreach ($CategoryAttribute as $k => $item) @endforeach @else @endif
Sr. No. Attribute Name Type of Attribute Associated Category Searchable Use in Filter Action
{{ $k + 1 + ($CategoryAttribute->currentPage() - 1) * $CategoryAttribute->perPage() }} {{ $item->title ?? 'N/A' }} {{ $item->type ?? 'N/A' }} @php $categories = explode('>', $item->category_names); $lastIndex = count($categories) - 1; // Get the last index @endphp

{{ $item->category_id ?? 'N/A' }}

    @foreach ($categories as $index => $part)
  • @if ($index === $lastIndex) {{ $part }} @else {{ $part }} @endif @if ($index < $lastIndex) > @endif
  • @endforeach
@if (!empty($item->related_category)) @php $previousSetId = null; $ulCount = 0; // Counter for the number of
    elements @endphp @foreach ($item->related_category as $related) @php // Build the category hierarchy $categoryHierarchy = []; $category = App\Models\Category::find($related['cat_id']); // Fetch the category // Traverse the parent categories to build the hierarchy while ($category) { array_unshift($categoryHierarchy, [ 'id' => $category->id, // Include the category ID 'name' => $category->name ?? 'N/A', ]); $category = $category->parent ? App\Models\Category::find($category->parent_id) : null; } @endphp {{-- Check if the current set_id is different from the previous one --}} @if ($related['set_id'] !== $previousSetId) @php $ulCount++; // Increment the
      counter $previousSetId = $related['set_id']; // Update the previousSetId @endphp {{-- Create a new
        for the current set_id --}}
          {{-- Loop through the category hierarchy --}} @foreach ($categoryHierarchy as $index => $category)
        • {{-- Add unique ID for each
        • --}} {{-- Add a separator for nested categories --}} @if ($index > 0) > @endif {{-- Display the category name --}} @if ($loop->last) {{ $category['name'] }} {{-- Bold the last category --}} @else {{ $category['name'] }} @endif
        • @endforeach {{-- Add a remove button for the category set --}}
        @endif @endforeach {{-- Add a "View All" button if there are multiple category sets --}}
        @if ($ulCount > 1) @endif
        @endif
{{ $item->use_in_search ?? 'N/A' }} {{ $item->use_in_filter ?? 'N/A' }}
@if (!empty(request()->search))

No result found

@else

No data added yet

@endif
Total Attributes:{{ $CategoryAttribute->total() }}
{{ $CategoryAttribute->appends(request()->input())->links() }}