{"id":19356723,"url":"https://github.com/savannabits/primevue-datatables","last_synced_at":"2025-04-23T10:32:58.180Z","repository":{"id":40368940,"uuid":"406055398","full_name":"savannabits/primevue-datatables","owner":"savannabits","description":"Easy Laravel Server-Side implementation of PrimeVue Datatables","archived":false,"fork":false,"pushed_at":"2024-03-25T14:46:08.000Z","size":56,"stargazers_count":30,"open_issues_count":10,"forks_count":20,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T14:11:15.888Z","etag":null,"topics":["datatables","laravel","php","primevue","primevue-datatables","primevue-laravel","server-side"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/savannabits.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-13T16:51:24.000Z","updated_at":"2025-02-27T17:28:17.000Z","dependencies_parsed_at":"2023-01-31T10:45:24.405Z","dependency_job_id":null,"html_url":"https://github.com/savannabits/primevue-datatables","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savannabits%2Fprimevue-datatables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savannabits%2Fprimevue-datatables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savannabits%2Fprimevue-datatables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savannabits%2Fprimevue-datatables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/savannabits","download_url":"https://codeload.github.com/savannabits/primevue-datatables/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250416859,"owners_count":21427076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datatables","laravel","php","primevue","primevue-datatables","primevue-laravel","server-side"],"created_at":"2024-11-10T07:05:23.060Z","updated_at":"2025-04-23T10:32:53.171Z","avatar_url":"https://github.com/savannabits.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel + PrimeVue Datatables\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/savannabits/primevue-datatables.svg?style=flat-square)](https://packagist.org/packages/savannabits/primevue-datatables)\n[![Total Downloads](https://img.shields.io/packagist/dt/savannabits/primevue-datatables.svg?style=flat-square)](https://packagist.org/packages/savannabits/primevue-datatables)\n![GitHub Actions](https://github.com/savannabits/primevue-datatables/actions/workflows/main.yml/badge.svg)\n\nThis is a simple, clean and fluent serve-side implementation of [PrimeVue Datatables](https://primefaces.org/primevue/showcase/#/datatable) in [Laravel](https://laravel.com/).\n\n![image](https://user-images.githubusercontent.com/5610289/159969279-155b736d-a1fa-49c8-a34a-cccc775103a4.png)\n\n## Features\n- Global Search including searching in relationships up to a depth of 3, e.g `author.user.name`\n- Per-Column filtering out of the box\n- Column Sorting with direction toggling\n- Pagination with a dynamic `no. or records per page` setting\n- Fully compatible with PrimeVue Datatable\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require savannabits/primevue-datatables\n```\n\n## Usage\n\n### Server Side\nIt is as simple as having this in your `index()` function of your controller:\n```php\npublic function index(Request $request): JsonResponse\n{\n    $list = PrimevueDatatables::of(Book::query())-\u003emake();\n    return response()-\u003ejson([\n        'success' =\u003e true,\n        'payload' =\u003e $list,\n    ]);\n}\n```\n#### Required Query Parameters\nThe server-side implementation uses two parameters from your laravel request object to perform filtering, sorting and pagination:\nYou have to pass the following parameters as query params from the client:\n1. Searchable Columns **(Passed as `searchable_columns`)** - Used to specify the columns that will be used to perform the global datatable search\n2. Dt Params **(Passed as `dt_params`)** - This is the main Datatable event object as received from PrimeVue. See [Lazy Datatable](https://primefaces.org/primevue/showcase/#/datatable/lazy) documentation for more details\n### Client Side:\n**Here is a gist of a [Fully Working Vue3 + Tailwindcss component](https://gist.github.com/coolsam726/f156daa5b36a7a8217526eb82bcaa798) for the client side**.\u003cbr\u003e\nGo through [PrimeVue's Lazy Datatable](https://primefaces.org/primevue/showcase/#/datatable/lazy) documentation for details on frontend implementation.\n\nHere is an example of your `loadLazyData()` implementation:\n\n```ts\nconst loadLazyData = async () =\u003e {\n    loading.value = true;\n\n    try {\n        const res = await axios.get('/api/books',{\n            params: {\n                dt_params: JSON.stringify(lazyParams.value),\n                searchable_columns: JSON.stringify(['title','author.name','price']),\n            },\n        });\n\n        records.value = res.data.payload.data;\n        totalRecords.value = res.data.payload.total;\n        loading.value = false;\n    } catch (e) {\n        records.value = [];\n        totalRecords.value = 0;\n        loading.value = false;\n    }\n};\n```\n\n### Testing\n\n```bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email maosa.sam@gmail.com instead of using the issue tracker.\n\n## Credits\n\n-   [Sam Maosa](https://github.com/savannabits)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavannabits%2Fprimevue-datatables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsavannabits%2Fprimevue-datatables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavannabits%2Fprimevue-datatables/lists"}