07-20-2023, 01:24 PM 
		
	
	Creating the Model for CodeIgniter
Once the database table has been created, begin working on the business logic. To do this, create a model that will retrieve the database values.
- Access File Manager
 - Paste the following code into the AgencyModel.php file:
 
Models are placed in the public_html/app/Models directory so they won't interfere with the application's directory structure. Go to the Models directory and create a new PHP file called AgencyModel.php.
<?php namespace App\Models;
use CodeIgniter\Database\ConnectionInterface;
use CodeIgniter\Model;
class AgencyModel extends Model
{
protected $table = 'agencies';
protected $allowedFields = ['name', 'email'];
}
As you can see, the model class (AgencyModel) extends the generic Model class that CodeIgniter provides. Note that CodeIgniter requires all class names to begin with a capital letter.

