Welcome Guest, Not a member yet? Register   Sign In
Using the built-in pagination functions

(This post was last modified: 01-20-2022, 05:35 AM by sjender.)

I would like to implement the pagination library for retrieving logs from the database.
This is one of my methods in a model:
PHP Code:
    public function getAllLogs(?string $searchString nullint $limit 50): array
        $getLogs $this->db->query("SELECT * FROM `logs` WHERE `string` = ? ORDER BY `insert_date` DESC LIMIT 0, ?", [$searchString$limit]);

        return $getLogs->getResultArray()?? [];

Please note that I have edited it a bit to be readable and safe here....
The manual tells me to do this:
PHP Code:
        $model = new \App\Models\UserModel();

        $data = [
            'users' => $model->paginate(10),
            'pager' => $model->pager,

        echo view('users/index'$data);
But how does this pagination knows  which method it should call (in my case getAllLogs).
And how can I pass my variable $searchString ?

Messages In This Thread
Using the built-in pagination functions - by sjender - 01-20-2022, 05:34 AM

Theme © iAndrew 2016 - Forum software by © MyBB