![]() |
pagination - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: pagination (/showthread.php?tid=77672) |
pagination - purbaphalguni - 10-01-2020 How to use pagination through MySQL query instead of using just the Model name? Controller code: PHP Code: namespace App\Controllers; PHP Code: namespace App\Models; NOTE: Please help me out using MYSQL query with user defined JOINS or UNION etc instead of using just the table name in Model (Table: users here). I want to use userdefined queries instead of mere table name and allowed fields RE: pagination - nc03061981 - 10-02-2020 In your Controller PHP Code: $pager = \Config\Services::pager(); In your Model, Overrite system function paginate PHP Code: public function paginate(int $perPage = null, string $group = 'default', int $page = null, int $segment = 0) This working fine for custom QUERY... RE: pagination - purbaphalguni - 10-02-2020 Thank you so much nc03061981. Overwriting the system method is such a cool idea. God Bless You and CI Team.... Love... RE: pagination - nc03061981 - 10-02-2020 I think CI4 have great Core System User can overrite but core still working fine Thanks CI4 Team RE: pagination - purbaphalguni - 10-02-2020 Yeah! Definitely... Thanks to CI 4 team... |