Creating Custom Models in CodeIgniter — a practical guide to CodeIgniter custom model with clear examples you can reuse in real projects.
CodeIgniter Tutorial Series (36/74). Prefer one article? Read the complete CodeIgniter tutorial.
Short description
Keep complex queries inside model methods so controllers stay thin.
Custom finder
public function published()
{
return $this->where('is_published', 1)
->orderBy('created_at', 'DESC')
->findAll();
}