[eluser]Keyur Shah[/eluser]
Hello,
I'm trying to figure out how to organize my models in a way that the model code does not get cluttered by unique queries that get used only by a single controller. In the documentation and tutorials, i usually see CRUD type queries that are very generic and can be used my many controllers.
For example, here is one function in my orders model (along side the generic getAll, getSingle type queries)
Code:
function update_email_sent($ordernumber)
{
if (isset($ordernumber)) {
$data = array('EmailSent'=>1);
$this->db->where("OrderNumber = $ordernumber");
$this->db->update('Orders',$data);
}
}
Is there any other way of refactoring this function to keep the model page uncluttered by queries like this? Or should I create a new model page with the same name as the controller? Looking for some best practices.
Thanks!