Skip to content

v1.2.0

Choose a tag to compare

@surazdott surazdott released this 26 Nov 07:24
· 8 commits to main since this release

Added: paginate Helper Method

A new helper method has been added to enhance API response handling:

paginate(string $message, mixed $data = [])

public function index()
{
    $users = UserResource::collection(User::active()->paginate(10));

    return api()->success('Data fetched successfully.', $users);
}
// Result
{
    "success": true,
    "message": "Request processed successfully.",
    "total": 20,
    "total_pages": 2,
    "per_page": 10,
    "data": [
        {
            "id": 1",
            "name": "Suraj....",
        },
        {
            "id": 2",
            "name": "Rabin....",
        }
    ]
}