monkenWu / TablesIgniter

Tableslgniter is an addins base on CodeIgniter4. It will help you use jQuery Datatables in server side mode.
https://tablesigniter.monken.tw/
MIT License
14 stars 7 forks source link

Model builder #5

Closed SimaWB closed 3 years ago

SimaWB commented 3 years ago

It's not an issue but I don't know where to write:

CI 4 models have query builder. Therefore; I think your noticeTable function is unnecessary. We can use $model->builder() directly.

monkenWu commented 3 years ago

Under the situation of simply querying the database, you're right since in the CodeIgniter4, we can use $model->builder() to access to the Query Builder instance.

But in fact, our Datatables could be consists of more complex SQL Query. We might be able to use syntax like where or join or even different syntaxes.It's not that appropriate to write such complex logic in the Controller.

Considering this, I designed the example code like that.