tstat_be/app/Models/CountryModel.php

29 lines
696 B
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class CountryModel extends Model
{
protected $table = 'm_country'; // Table name
protected $primaryKey = 'country_id'; // Primary key
// Fields to be allowed in insert or update operations
protected $allowedFields = [
'country_code','country_name','region','currency','is_active'
];
// Specify the return type of the results
protected $returnType = 'array';
// Define where clause to get active records by default
protected $useTimestamps = true;
public function getActiveCountries()
{
return $this->where('is_active', 1)->findAll();
}
}