Blog Categories
@php // Get selected slugs from query parameter or from URL path $selectedSlugs = collect(explode(',', request()->query('category')))->filter(); // If we're on a single category page, add that slug to selected slugs if ($categorySlug) { $selectedSlugs->push($categorySlug); } @endphp-
@foreach(Helper::postCategoryList() as $i => $cat)
@php
$id = "cat_".$i;
$checked = $selectedSlugs->contains($cat->slug);
@endphp
- @endforeach