weelow Posted April 4, 2020 Share Posted April 4, 2020 Hello, as per whmcs, we should refer to Larvael database documentation. https://laravel.com/docs/master/pagination i tried to do it to split the query results over several pages and use the pagination generate links function to do it easily. I keep getting errors every time i replace the ->get(); with ->paginate(20); there is a work around of course to create a code that would paginate but i wanted to take advantage of how it is done in larvael. Any help is appreciated. Thanks, 0 Quote Link to comment Share on other sites More sharing options...
weelow Posted April 8, 2020 Author Share Posted April 8, 2020 I couldn't get this working. It seems it is not supported in WHMCS so I did it using limit & offset. Took longer to setup and more code written but it works. If anyone needs help setting it up please tell me. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted April 8, 2020 Share Posted April 8, 2020 (edited) You could try looking at this thread. As far as I know Laravel pagination is not included in WHMCS but most importatly «pagination operations that use a groupBy statement cannot be executed efficiently by Laravel. If you need to use a groupBy with a paginated result set, it is recommended that you query the database and create a paginator manually» I would laugh if it wasn't so sad. Edited April 8, 2020 by Kian 0 Quote Link to comment Share on other sites More sharing options...
weelow Posted April 9, 2020 Author Share Posted April 9, 2020 Thanks Kian, you are right. it seems whmcs is using larvael 5.2 and pagination was not in that version as per documentation. It was only available starting version 5.3https://laravel.com/docs/5.2/queries the only way to do it is using limit & offset and using loops to create the pages and linkshttps://laravel.com/docs/5.2/queries#ordering-grouping-limit-and-offset I will post the way i did it on the link you shared so i can share it with the community. 0 Quote Link to comment Share on other sites More sharing options...
weelow Posted April 9, 2020 Author Share Posted April 9, 2020 (edited) If anyone is looking for how to do this, click the link below. If any moderator is reading, kindly close this ticket. Thanks Edited April 9, 2020 by weelow 0 Quote Link to comment Share on other sites More sharing options...
airbytes Posted July 20, 2022 Share Posted July 20, 2022 Hi weelow, can you help me with pagination for two custom hooks, what shows data from the same database but different table, I have a pagination in place but in address bar is adding me https://whmcs.instance/clientarea.php?action=productdetails&id=50&pageno=3 and if I switch to other hook what take information from the same db but other table is checking from the page 3 not from the page 1. it is anything you can do ? or give me an advice. who did the pagination for me is unavailable at the moment to have a look. thanks, Alex 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.