# Fix DataTables Invalid JSON Response on Admin Categories Page

## Approved Plan Summary
- Update `app/Http/Controllers/CategoryController.php` index method to handle AJAX/DataTables requests by returning proper JSON structure (draw, recordsTotal, recordsFiltered, data).
- Non-AJAX requests continue returning the view as-is.
- Test page reload, pagination, search.

## Steps (1/1 remaining):

### 1. [✅] Edit CategoryController@index
   - Read current controller content (already done).
   - Add logic: if `request()->ajax()` or `request()->has('draw')`, compute DataTables JSON.
   - Use Category::query(), apply search on 'title', ordering, pagination via offset/limit.
   - Transform rows for table columns (checkbox, index, title, image, icon, status badge, position, actions).
   - Use `edit_file` tool with precise diff.
   - After success: Test `/admin/category`, clear caches if needed (`php artisan route:clear view:clear cache:clear`), verify no JSON error.

## Next Action
Proceed to step 1: Edit the controller.

