This npm package provides TypeScript definitions for Laravel pagination resources. It includes interfaces for paginated resource data, pagination links, and pagination meta information.
You can install this package via npm:
npm install laravel-resource-pagination-type
import { LaravelPaginatedResource } from 'laravel-resource-pagination-type';
// Define paginated resource data
interface User {
id: number;
name: string;
email: string;
}
// Sample paginated resource containing users
const paginatedUsers: LaravelPaginatedResource<User> = {
data: [
{ id: 1, name: 'John Doe', email: 'john@example.com' },
{ id: 2, name: 'Jane Smith', email: 'jane@example.com' },
// Add more user objects as needed
],
links: {
first: '/users?page=1',
last: '/users?page=10',
prev: '/users?page=2',
next: '/users?page=4'
},
meta: {
current_page: 3,
from: 21,
last_page: 10,
path: '/users',
per_page: 10,
to: 30,
total: 100
}
};
This package is open-sourced software licensed uner the MIT License