cURL
curl --request GET \ --url https://api.example.com/api/post
{ "code": 123, "status": "<string>", "posts": [ { "id": 123, "user_id": 123, "category_id": 123, "title": "<string>", "content": "<string>", "image": "<string>", "created_at": "<string>", "updated_at": "<string>", "category": {} } ] }
Retrieve a list of all blog posts with their category information
GET /api/post
api.auth
{ "code": 200, "status": "success", "posts": [ { "id": 1, "user_id": 5, "category_id": 2, "title": "Introduction to Laravel", "content": "Laravel is a powerful PHP framework...", "image": "1678901234image.jpg", "created_at": "2026-03-01T10:30:00.000000Z", "updated_at": "2026-03-01T10:30:00.000000Z", "category": { "id": 2, "name": "Technology", "created_at": "2026-01-15T08:00:00.000000Z", "updated_at": "2026-01-15T08:00:00.000000Z" } }, { "id": 2, "user_id": 3, "category_id": 1, "title": "Getting Started with APIs", "content": "APIs are essential for modern web development...", "image": "1678901567api.png", "created_at": "2026-03-02T14:20:00.000000Z", "updated_at": "2026-03-02T14:20:00.000000Z", "category": { "id": 1, "name": "Web Development", "created_at": "2026-01-10T12:00:00.000000Z", "updated_at": "2026-01-10T12:00:00.000000Z" } } ] }
$posts = Post::all()->load('category');