==================================================== GRIEVANCE PAGINATION TESTING SCRIPT ==================================================== To use this script, you have several options: 1. CREATE SAMPLE DATA: $count = createSampleGrievances(); echo "Created $count sample grievances"; 2. TEST PAGINATION FUNCTIONALITY: testGrievancePagination(); 3. TEST HTTP ENDPOINTS: testHttpRequests(); 4. GET CURL EXAMPLES: $examples = getCurlExamples(); foreach ($examples as $name => $command) { echo "$name:\n$command\n\n"; } LARAVEL TINKER USAGE: ---------------------- php artisan tinker require_once 'test_grievance_pagination.php'; createSampleGrievances(); testGrievancePagination(); POSTMAN/INSOMNIA TESTING: ------------------------ Import the following endpoints: - GET /api/grievance/paginated - GET /api/grievance/paginated-all SAMPLE REQUEST URLS: ------------------- Search by Ration Card: curl -X GET "http://localhost:8000/api/grievance/paginated?ration_card_number=RC123456&per_page=5&page=1" Search with Status Filter: curl -X GET "http://localhost:8000/api/grievance/paginated?ration_card_number=RC123456&status=OPEN&per_page=10&page=1" Get All Open Grievances: curl -X GET "http://localhost:8000/api/grievance/paginated-all?status=OPEN&per_page=15&page=1" Get All Grievances: curl -X GET "http://localhost:8000/api/grievance/paginated-all?per_page=20&page=1" Create Sample Grievance: curl -X POST "http://localhost:8000/api/grievance/create" \ -H "Content-Type: application/json" \ -d '{ "voter_id": "V006", "ration_card_number": "RC999888", "title": "Test grievance for pagination", "description": "This is a test grievance to check pagination functionality", "status": "OPEN", "target_resolve_by": "2024-12-30" }' RESPONSE STRUCTURE EXAMPLE: -------------------------- { "status": 200, "message": "Grievances retrieved successfully", "data": { "grievances": [...], "pagination": { "current_page": 1, "last_page": 3, "per_page": 15, "total": 42, "has_more_pages": true }, "search_criteria": { "ration_card_number": "RC123456", "status": null }, "status_counts": { "OPEN": 15, "IN_PROGRESS": 8, "CLOSED": 12 } } } ====================================================