@@ -39,13 +39,34 @@ The first element is the results from the database, **users**, which is retrieve
3939the Model will hold on to the instance it used and store it in the public property, ``$pager ``. So, we grab
4040that and assign it to the ``$pager `` variable in the view.
4141
42- .. important :: It is important to understand that the ``Model::paginate()`` method uses the **Model** and **QueryBuilder** methods.
43- Therefore, trying to use ``$db->query() `` and ``Model::paginate() `` **will not work ** because ``$db->query() `` executes
44- the query immediately and is not associated with a QueryBuilder.
42+ Customizing Query for Pagination
43+ ================================
4544
46- To define conditions for pagination in a model, you can:
45+ To customize a query for pagination in a model, you can add
46+ :doc: `Query Builder <../database/query_builder >` methods before ``paginate() ``
47+ method.
48+
49+ To add WHERE conditions:
4750
4851.. literalinclude :: pagination/003.php
52+ :lines: 2-
53+
54+ You can join another table:
55+
56+ .. literalinclude :: pagination/016.php
57+ :lines: 2-
58+
59+ .. important :: It is important to understand that the ``Model::paginate()`` method
60+ uses the **Model ** and the **Query Builder ** instance in the Model.
61+ Therefore, trying to use ``Model::paginate() `` with :ref: `db-query `
62+ **will not work ** because ``$db->query() `` executes the query immediately
63+ and is not associated with the Query Builder.
64+
65+ If you need a complicated SQL query that you cannot write with Query Builder,
66+ try using :ref: `db-query ` and `Manual Pagination `_.
67+
68+ Displaying Pager Links
69+ ======================
4970
5071Within the view, we then need to tell it where to display the resulting links::
5172
0 commit comments