cURL
curl --request GET \ --url https://api.example.com/api/post/category/{id}
{ "status": "<string>", "posts": [ { "id": 123, "user_id": 123, "category_id": 123, "title": "<string>", "content": "<string>", "image": "<string>", "created_at": "<string>", "updated_at": "<string>" } ] }
Retrieve all blog posts belonging to a specific category
GET /api/post/category/{id}
Show Post object properties
curl -X GET "https://api.example.com/api/post/category/1"
{ "status": "success", "posts": [ { "id": 1, "user_id": 3, "category_id": 1, "title": "Getting Started with Laravel", "content": "Laravel is a powerful PHP framework...", "image": "1709564730laravel.jpg", "created_at": "2024-03-04T10:30:00.000000Z", "updated_at": "2024-03-04T10:30:00.000000Z" }, { "id": 5, "user_id": 2, "category_id": 1, "title": "Advanced Laravel Techniques", "content": "Explore advanced patterns in Laravel development...", "image": "1709568920advanced.jpg", "created_at": "2024-03-04T12:15:00.000000Z", "updated_at": "2024-03-04T12:15:00.000000Z" } ] }
$posts = Post::where('category_id', $id)->get();
posts