@forelse ($info as $categoryName => $questions)
@php
// Find the category object by name
$category = $categories->firstWhere('name', $categoryName);
@endphp
$record->id]) }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
body: JSON.stringify({
category_id: this.categoryId,
is_expanded: this.isExpanded
})
});
const data = await response.json();
if (!data.success) {
// Failed to save category state
}
} catch (error) {
// Error saving category state
}
}
}"
data-category-id="{{ $category->id ?? null }}">