A Model in CodeIgniter is responsible for interacting with the database. It contains all the logic related to data retrieval, insertion, update, and deletion.
Handles database operations
Represents a database table
Keeps business logic out of controllers
Works with Query Builder automatically
Provides object-oriented data handling.
✅ One model per table
✅ Keep database logic in models
✅ Use validation & timestamps
❌ Avoid direct SQL in controllers
Models manage database interactions
Stored in app/Models
Provide CRUD, validation, soft deletes
Keep controllers clean and maintainable
Take quizzes related to this topic and see where you stand!
Start Quiz Now